From a204259b1c54c11ed26f4d8d1fd792ee21894fc4 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 25 Mar 2016 19:32:38 -0400 Subject: [PATCH] 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. --- src/kits/interface/Shape.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/kits/interface/Shape.cpp b/src/kits/interface/Shape.cpp index 2819a87e48..d6e195da78 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(); }