hrev50165 adds 1 changeset to branch 'master'
old head: 8c7679851f61f3e9d32951ea7eff7a89c78f9442
new head: a204259b1c54c11ed26f4d8d1fd792ee21894fc4
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=a204259b1c54+%5E8c7679851f61
----------------------------------------------------------------------------
a204259b1c54: BShape: Fix issues for debug build.
As part of the refactoring that was done for app_server layer support,
the private shape_data struct was updated to derive from BReferenceable.
However, BShape's destructor was never updated to reflect this, and
consequently attempts to use a debug build of libbe would consistently
throw the user into the debugger due to BReferenceable's sanity check
against non-zero deletes that weren't on the stack.
It should be noted though that there are probably a few things that could
be factored out and/or simplified with that class in general, since e.g.
when copying its data from another shape_data instance, it uses C++ array
allocations, while when being manipulated by BShape directly, the latter
uses alloc/realloc/free.
[ Rene Gollent <rene@xxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev50165
Commit: a204259b1c54c11ed26f4d8d1fd792ee21894fc4
URL: http://cgit.haiku-os.org/haiku/commit/?id=a204259b1c54
Author: Rene Gollent <rene@xxxxxxxxxxx>
Date: Fri Mar 25 23:32:38 2016 UTC
----------------------------------------------------------------------------
1 file changed, 5 insertions(+), 4 deletions(-)
src/kits/interface/Shape.cpp | 9 +++++----
----------------------------------------------------------------------------
diff --git a/src/kits/interface/Shape.cpp b/src/kits/interface/Shape.cpp
index 2819a87..d6e195d 100644
--- a/src/kits/interface/Shape.cpp
+++ b/src/kits/interface/Shape.cpp
@@ -183,11 +183,12 @@ BShape::BShape(BMessage* archive)
BShape::~BShape()
{
shape_data* data = (shape_data*)fPrivateData;
+ if (!data->fOwnsMemory) {
+ free(data->opList);
+ free(data->ptList);
+ }
- free(data->opList);
- free(data->ptList);
-
- delete (shape_data*)fPrivateData;
+ data->ReleaseReference();
}