From 0cbb6c11eec74201f566920c90ebd2c5546b7aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 9 May 2015 21:38:15 +0200 Subject: [PATCH] Icon-O-Matic: Make GradientTransformable a BReferenceable * Switch to using support/Referenceable.h instead of using an older copy of this code. * Make GradientTransformable a BReferenceable and fix #12033. --- src/apps/icon-o-matic/Jamfile | 1 - src/apps/icon-o-matic/MainWindow.cpp | 4 +- src/apps/icon-o-matic/document/Document.cpp | 4 +- src/apps/icon-o-matic/document/IconObject.cpp | 6 +- src/apps/icon-o-matic/document/IconObject.h | 4 +- .../generic/support/Referenceable.cpp | 77 ------------------- .../generic/support/Referenceable.h | 27 ------- .../icon-o-matic/gui/IconObjectListView.cpp | 4 +- src/apps/icon-o-matic/gui/PathListView.cpp | 4 +- src/apps/icon-o-matic/gui/ShapeListView.cpp | 4 +- src/apps/icon-o-matic/gui/StyleListView.cpp | 4 +- src/apps/icon-o-matic/gui/StyleView.cpp | 16 ++-- .../icon-o-matic/gui/TransformerListView.cpp | 4 +- .../import_export/svg/DocumentBuilder.cpp | 6 +- .../icon-o-matic/shape/PathManipulator.cpp | 4 +- .../shape/commands/AddPathsCommand.cpp | 4 +- .../shape/commands/AddShapesCommand.cpp | 2 +- .../shape/commands/RemovePathsCommand.cpp | 2 +- .../shape/commands/RemoveShapesCommand.cpp | 2 +- .../shape/commands/UnassignPathCommand.cpp | 2 +- .../icon-o-matic/style/AddStylesCommand.cpp | 2 +- .../icon-o-matic/style/AssignStyleCommand.cpp | 8 +- .../style/RemoveStylesCommand.cpp | 2 +- .../icon-o-matic/style/SetGradientCommand.cpp | 7 +- .../transformable/TransformGradientBox.cpp | 4 +- .../TransformGradientCommand.cpp | 6 +- .../transformable/TransformPointsBox.cpp | 4 +- .../transformable/TransformShapesBox.cpp | 4 +- src/libs/icon/Icon.h | 4 +- src/libs/icon/shape/PathContainer.cpp | 2 +- src/libs/icon/shape/Shape.cpp | 8 +- src/libs/icon/shape/ShapeContainer.cpp | 2 +- src/libs/icon/style/GradientTransformable.cpp | 3 + src/libs/icon/style/GradientTransformable.h | 2 + src/libs/icon/style/Style.cpp | 5 ++ src/libs/icon/style/StyleContainer.cpp | 2 +- 36 files changed, 79 insertions(+), 167 deletions(-) delete mode 100644 src/apps/icon-o-matic/generic/support/Referenceable.cpp delete mode 100644 src/apps/icon-o-matic/generic/support/Referenceable.h diff --git a/src/apps/icon-o-matic/Jamfile b/src/apps/icon-o-matic/Jamfile index 2a0be6ee21..3e8f895167 100644 --- a/src/apps/icon-o-matic/Jamfile +++ b/src/apps/icon-o-matic/Jamfile @@ -198,7 +198,6 @@ Application Icon-O-Matic : Selection.cpp # generic/support - Referenceable.cpp RWLocker.cpp support.cpp support_ui.cpp diff --git a/src/apps/icon-o-matic/MainWindow.cpp b/src/apps/icon-o-matic/MainWindow.cpp index 2b090a0f45..9f2dee2d22 100644 --- a/src/apps/icon-o-matic/MainWindow.cpp +++ b/src/apps/icon-o-matic/MainWindow.cpp @@ -839,7 +839,7 @@ MainWindow::SetIcon(Icon* icon) fIcon = icon; if (fIcon != NULL) - fIcon->Acquire(); + fIcon->AcquireReference(); else MakeEmpty(); @@ -865,7 +865,7 @@ MainWindow::SetIcon(Icon* icon) // keep this last if (oldIcon != NULL) - oldIcon->Release(); + oldIcon->ReleaseReference(); } diff --git a/src/apps/icon-o-matic/document/Document.cpp b/src/apps/icon-o-matic/document/Document.cpp index e44ef85d48..c78ae8c6ed 100644 --- a/src/apps/icon-o-matic/document/Document.cpp +++ b/src/apps/icon-o-matic/document/Document.cpp @@ -46,7 +46,7 @@ Document::~Document() { delete fCommandStack; delete fSelection; - fIcon->Release(); + fIcon->ReleaseReference(); delete fNativeSaver; delete fExportSaver; } @@ -92,7 +92,7 @@ Document::SetIcon(_ICON_NAMESPACE Icon* icon) if (fIcon == icon) return; - fIcon->Release(); + fIcon->ReleaseReference(); fIcon = icon; diff --git a/src/apps/icon-o-matic/document/IconObject.cpp b/src/apps/icon-o-matic/document/IconObject.cpp index 68d87e972b..9ba83f8a44 100644 --- a/src/apps/icon-o-matic/document/IconObject.cpp +++ b/src/apps/icon-o-matic/document/IconObject.cpp @@ -17,7 +17,7 @@ // constructor IconObject::IconObject(const char* name) : Observable(), - Referenceable(), + BReferenceable(), Selectable(), fName(name) @@ -27,7 +27,7 @@ IconObject::IconObject(const char* name) // copy constructor IconObject::IconObject(const IconObject& other) : Observable(), - Referenceable(), + BReferenceable(), Selectable(), fName(other.fName) @@ -37,7 +37,7 @@ IconObject::IconObject(const IconObject& other) // archive constructor IconObject::IconObject(BMessage* archive) : Observable(), - Referenceable(), + BReferenceable(), Selectable(), fName() diff --git a/src/apps/icon-o-matic/document/IconObject.h b/src/apps/icon-o-matic/document/IconObject.h index 751b236adb..77c93f3978 100644 --- a/src/apps/icon-o-matic/document/IconObject.h +++ b/src/apps/icon-o-matic/document/IconObject.h @@ -9,17 +9,17 @@ #ifndef ICON_OBJECT_H #define ICON_OBJECT_H +#include #include #include "Observable.h" -#include "Referenceable.h" #include "Selectable.h" class BMessage; class PropertyObject; class IconObject : public Observable, - public Referenceable, + public BReferenceable, public Selectable { public: IconObject(const char* name); diff --git a/src/apps/icon-o-matic/generic/support/Referenceable.cpp b/src/apps/icon-o-matic/generic/support/Referenceable.cpp deleted file mode 100644 index 15958e86b9..0000000000 --- a/src/apps/icon-o-matic/generic/support/Referenceable.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Axel Dörfler, axeld@pinc-software.de - * Stephan Aßmus - */ - -#include "Referenceable.h" - -#define TRACE 0 - -#if TRACE -#define ICON 1 -#include -#include - -#if ICON -#include "IconObject.h" -#endif -#endif - -// constructor -Referenceable::Referenceable() - : fReferenceCount(1) -{ -} - -// destructor -Referenceable::~Referenceable() -{ -} - -// Acquire -void -Referenceable::Acquire() -{ - atomic_add(&fReferenceCount, 1); -} - -// Release -bool -Referenceable::Release() -{ -#if TRACE - int32 old = atomic_add(&fReferenceCount, -1); -//#if ICON -// if (old > 1) { -//IconObject* object = dynamic_cast(this); -//printf("Referenceable::Release() - %s: %ld\n", -// object ? object->Name() : "unkown", fReferenceCount); -// } else -//#endif - if (old == 1) { -#if ICON -IconObject* object = dynamic_cast(this); -printf("Referenceable::Release() - deleting %s\n", - object ? object->Name() : "unkown"); -#else -printf("Referenceable::Release() - deleting\n"); -#endif - delete this; - return true; - } else if (old < 1) - debugger("Referenceable::Release() - already deleted"); -#else - if (atomic_add(&fReferenceCount, -1) == 1) { - delete this; - return true; - } -#endif - - return false; -} - diff --git a/src/apps/icon-o-matic/generic/support/Referenceable.h b/src/apps/icon-o-matic/generic/support/Referenceable.h deleted file mode 100644 index 6539324e9f..0000000000 --- a/src/apps/icon-o-matic/generic/support/Referenceable.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2001-2006, Haiku. - * Distributed under the terms of the MIT License. - * - * Authors: - * DarkWyrm - * Axel Dörfler, axeld@pinc-software.de - * Stephan Aßmus - */ -#ifndef REFERENCABLE_H -#define REFERENCABLE_H - -#include - -class Referenceable { - public: - Referenceable(); - virtual ~Referenceable(); - - void Acquire(); - bool Release(); - - private: - int32 fReferenceCount; -}; - -#endif // REFERENCABLE_H diff --git a/src/apps/icon-o-matic/gui/IconObjectListView.cpp b/src/apps/icon-o-matic/gui/IconObjectListView.cpp index d017d548b3..09ef633220 100644 --- a/src/apps/icon-o-matic/gui/IconObjectListView.cpp +++ b/src/apps/icon-o-matic/gui/IconObjectListView.cpp @@ -204,14 +204,14 @@ IconObjectListView::_SetObject(IconObject* object) if (fObject) { fObject->RemoveObserver(this); - fObject->Release(); + fObject->ReleaseReference(); } fObject = object; PropertyObject* propertyObject = NULL; if (fObject) { - fObject->Acquire(); + fObject->AcquireReference(); fObject->AddObserver(this); propertyObject = fObject->MakePropertyObject(); } diff --git a/src/apps/icon-o-matic/gui/PathListView.cpp b/src/apps/icon-o-matic/gui/PathListView.cpp index b0c022231a..61a3d27ed2 100644 --- a/src/apps/icon-o-matic/gui/PathListView.cpp +++ b/src/apps/icon-o-matic/gui/PathListView.cpp @@ -129,13 +129,13 @@ public: if (path) { path->RemoveObserver(this); - path->Release(); + path->ReleaseReference(); } path = p; if (path) { - path->Acquire(); + path->AcquireReference(); path->AddObserver(this); UpdateText(); } diff --git a/src/apps/icon-o-matic/gui/ShapeListView.cpp b/src/apps/icon-o-matic/gui/ShapeListView.cpp index 91e9b3b979..d536a7357f 100644 --- a/src/apps/icon-o-matic/gui/ShapeListView.cpp +++ b/src/apps/icon-o-matic/gui/ShapeListView.cpp @@ -76,13 +76,13 @@ public: if (shape) { shape->RemoveObserver(this); - shape->Release(); + shape->ReleaseReference(); } shape = s; if (shape) { - shape->Acquire(); + shape->AcquireReference(); shape->AddObserver(this); UpdateText(); } diff --git a/src/apps/icon-o-matic/gui/StyleListView.cpp b/src/apps/icon-o-matic/gui/StyleListView.cpp index 7cd7808c61..a5a49d8991 100644 --- a/src/apps/icon-o-matic/gui/StyleListView.cpp +++ b/src/apps/icon-o-matic/gui/StyleListView.cpp @@ -130,13 +130,13 @@ public: if (style) { style->RemoveObserver(this); - style->Release(); + style->ReleaseReference(); } style = s; if (style) { - style->Acquire(); + style->AcquireReference(); style->AddObserver(this); UpdateText(); } diff --git a/src/apps/icon-o-matic/gui/StyleView.cpp b/src/apps/icon-o-matic/gui/StyleView.cpp index db64c16e4c..e0229a8fc3 100644 --- a/src/apps/icon-o-matic/gui/StyleView.cpp +++ b/src/apps/icon-o-matic/gui/StyleView.cpp @@ -253,14 +253,14 @@ StyleView::SetStyle(Style* style) if (fStyle) { fStyle->RemoveObserver(this); - fStyle->Release(); + fStyle->ReleaseReference(); } fStyle = style; Gradient* gradient = NULL; if (fStyle) { - fStyle->Acquire(); + fStyle->AcquireReference(); fStyle->AddObserver(this); gradient = fStyle->Gradient(); @@ -308,13 +308,16 @@ StyleView::_SetGradient(Gradient* gradient, bool forceControlUpdate, if (!forceControlUpdate && fGradient == gradient) return; - if (fGradient) - fGradient->RemoveObserver(this); + Gradient* oldGradient = fGradient; + if (oldGradient != NULL) + oldGradient->RemoveObserver(this); fGradient = gradient; - if (fGradient) + if (fGradient) { + fGradient->AcquireReference(); fGradient->AddObserver(this); + } if (fGradient) { fGradientControl->SetEnabled(true); @@ -329,6 +332,9 @@ StyleView::_SetGradient(Gradient* gradient, bool forceControlUpdate, _MarkType(fGradientType->Menu(), -1); } + if (oldGradient != NULL) + oldGradient->ReleaseReference(); + if (sendMessage) { BMessage message(MSG_STYLE_TYPE_CHANGED); message.AddPointer("style", fStyle); diff --git a/src/apps/icon-o-matic/gui/TransformerListView.cpp b/src/apps/icon-o-matic/gui/TransformerListView.cpp index b485713e18..cf5b3a1837 100644 --- a/src/apps/icon-o-matic/gui/TransformerListView.cpp +++ b/src/apps/icon-o-matic/gui/TransformerListView.cpp @@ -68,13 +68,13 @@ class TransformerItem : public SimpleItem, if (transformer) { transformer->RemoveObserver(this); - transformer->Release(); + transformer->ReleaseReference(); } transformer = t; if (transformer) { - transformer->Acquire(); + transformer->AcquireReference(); transformer->AddObserver(this); UpdateText(); } diff --git a/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp b/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp index 34f712f92f..39fd6d5aab 100644 --- a/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp +++ b/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp @@ -534,7 +534,7 @@ printf("scale: %f\n", scale); if (*style == *earlierStyle) { shape->SetStyle(earlierStyle); icon->Styles()->RemoveStyle(style); - style->Release(); + style->ReleaseReference(); break; } } @@ -649,7 +649,7 @@ AddPathsFromVertexSource(Icon* icon, Shape* shape, //printf(" path with no points!\n"); icon->Paths()->RemovePath(path); shape->Paths()->RemovePath(path); - path->Release(); + path->ReleaseReference(); } path = new (nothrow) VectorPath(); if (!path || !icon->Paths()->AddPath(path)) { @@ -745,7 +745,7 @@ AddPathsFromVertexSource(Icon* icon, Shape* shape, //printf("path with no points!\n"); icon->Paths()->RemovePath(path); shape->Paths()->RemovePath(path); - path->Release(); + path->ReleaseReference(); } return B_OK; diff --git a/src/apps/icon-o-matic/shape/PathManipulator.cpp b/src/apps/icon-o-matic/shape/PathManipulator.cpp index 4e50c1169d..62909f9b26 100644 --- a/src/apps/icon-o-matic/shape/PathManipulator.cpp +++ b/src/apps/icon-o-matic/shape/PathManipulator.cpp @@ -235,7 +235,7 @@ PathManipulator::PathManipulator(VectorPath* path) fLastNudgeTime(system_time()), fNudgeCommand(NULL) { - fPath->Acquire(); + fPath->AcquireReference(); fPath->AddListener(this); fPath->AddObserver(this); } @@ -255,7 +255,7 @@ PathManipulator::~PathManipulator() fPath->RemoveObserver(this); fPath->RemoveListener(this); - fPath->Release(); + fPath->ReleaseReference(); } diff --git a/src/apps/icon-o-matic/shape/commands/AddPathsCommand.cpp b/src/apps/icon-o-matic/shape/commands/AddPathsCommand.cpp index 6ded3dd1d0..9e49364921 100644 --- a/src/apps/icon-o-matic/shape/commands/AddPathsCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/AddPathsCommand.cpp @@ -48,7 +48,7 @@ AddPathsCommand::AddPathsCommand(PathContainer* container, // Add references to paths for (int32 i = 0; i < fCount; i++) { if (fPaths[i] != NULL) - fPaths[i]->Acquire(); + fPaths[i]->AcquireReference(); } } } @@ -59,7 +59,7 @@ AddPathsCommand::~AddPathsCommand() if (!fPathsAdded && fPaths) { for (int32 i = 0; i < fCount; i++) { if (fPaths[i] != NULL) - fPaths[i]->Release(); + fPaths[i]->ReleaseReference(); } } delete[] fPaths; diff --git a/src/apps/icon-o-matic/shape/commands/AddShapesCommand.cpp b/src/apps/icon-o-matic/shape/commands/AddShapesCommand.cpp index 4417130f72..bb30005d63 100644 --- a/src/apps/icon-o-matic/shape/commands/AddShapesCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/AddShapesCommand.cpp @@ -52,7 +52,7 @@ AddShapesCommand::~AddShapesCommand() { if (!fShapesAdded && fShapes) { for (int32 i = 0; i < fCount; i++) - fShapes[i]->Release(); + fShapes[i]->ReleaseReference(); } delete[] fShapes; } diff --git a/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.cpp b/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.cpp index 9236a1fd18..c1a69c9325 100644 --- a/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/RemovePathsCommand.cpp @@ -58,7 +58,7 @@ RemovePathsCommand::~RemovePathsCommand() if (fPathsRemoved && fInfos) { for (int32 i = 0; i < fCount; i++) { if (fInfos[i].path) - fInfos[i].path->Release(); + fInfos[i].path->ReleaseReference(); } } delete[] fInfos; diff --git a/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.cpp b/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.cpp index f826569af4..e54682ebeb 100644 --- a/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/RemoveShapesCommand.cpp @@ -49,7 +49,7 @@ RemoveShapesCommand::~RemoveShapesCommand() { if (fShapesRemoved && fShapes) { for (int32 i = 0; i < fCount; i++) - fShapes[i]->Release(); + fShapes[i]->ReleaseReference(); } delete[] fShapes; delete[] fIndices; diff --git a/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.cpp b/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.cpp index 8d2a5de19f..299fd853dc 100644 --- a/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.cpp +++ b/src/apps/icon-o-matic/shape/commands/UnassignPathCommand.cpp @@ -34,7 +34,7 @@ UnassignPathCommand::UnassignPathCommand(Shape* shape, UnassignPathCommand::~UnassignPathCommand() { if (fPathRemoved && fPath) - fPath->Release(); + fPath->ReleaseReference(); } // InitCheck diff --git a/src/apps/icon-o-matic/style/AddStylesCommand.cpp b/src/apps/icon-o-matic/style/AddStylesCommand.cpp index 46d73bb086..a936bdd668 100644 --- a/src/apps/icon-o-matic/style/AddStylesCommand.cpp +++ b/src/apps/icon-o-matic/style/AddStylesCommand.cpp @@ -48,7 +48,7 @@ AddStylesCommand::~AddStylesCommand() { if (!fStylesAdded && fStyles) { for (int32 i = 0; i < fCount; i++) - fStyles[i]->Release(); + fStyles[i]->ReleaseReference(); } delete[] fStyles; } diff --git a/src/apps/icon-o-matic/style/AssignStyleCommand.cpp b/src/apps/icon-o-matic/style/AssignStyleCommand.cpp index 8a3a56b582..90f2a928be 100644 --- a/src/apps/icon-o-matic/style/AssignStyleCommand.cpp +++ b/src/apps/icon-o-matic/style/AssignStyleCommand.cpp @@ -28,18 +28,18 @@ AssignStyleCommand::AssignStyleCommand(Shape* shape, fNewStyle(style) { if (fOldStyle) - fOldStyle->Acquire(); + fOldStyle->AcquireReference(); if (fNewStyle) - fNewStyle->Acquire(); + fNewStyle->AcquireReference(); } // destructor AssignStyleCommand::~AssignStyleCommand() { if (fOldStyle) - fOldStyle->Release(); + fOldStyle->ReleaseReference(); if (fNewStyle) - fNewStyle->Release(); + fNewStyle->ReleaseReference(); } // InitCheck diff --git a/src/apps/icon-o-matic/style/RemoveStylesCommand.cpp b/src/apps/icon-o-matic/style/RemoveStylesCommand.cpp index a4134f75cb..b29020efad 100644 --- a/src/apps/icon-o-matic/style/RemoveStylesCommand.cpp +++ b/src/apps/icon-o-matic/style/RemoveStylesCommand.cpp @@ -58,7 +58,7 @@ RemoveStylesCommand::~RemoveStylesCommand() if (fStylesRemoved && fInfos) { for (int32 i = 0; i < fCount; i++) { if (fInfos[i].style) - fInfos[i].style->Release(); + fInfos[i].style->ReleaseReference(); } } delete[] fInfos; diff --git a/src/apps/icon-o-matic/style/SetGradientCommand.cpp b/src/apps/icon-o-matic/style/SetGradientCommand.cpp index 97422bbc93..e966368bd8 100644 --- a/src/apps/icon-o-matic/style/SetGradientCommand.cpp +++ b/src/apps/icon-o-matic/style/SetGradientCommand.cpp @@ -36,7 +36,8 @@ SetGradientCommand::SetGradientCommand(Style* style, // destructor SetGradientCommand::~SetGradientCommand() { - delete fGradient; + if (fGradient != NULL) + fGradient->ReleaseReference(); } // InitCheck @@ -77,9 +78,9 @@ SetGradientCommand::Perform() return B_NO_MEMORY; } } - } else { + } else if (fGradient != NULL) { // the style didn't have a gradient set - delete fGradient; + fGradient->ReleaseReference(); fGradient = NULL; } diff --git a/src/apps/icon-o-matic/transformable/TransformGradientBox.cpp b/src/apps/icon-o-matic/transformable/TransformGradientBox.cpp index fc207ce69f..2b1c9108ec 100644 --- a/src/apps/icon-o-matic/transformable/TransformGradientBox.cpp +++ b/src/apps/icon-o-matic/transformable/TransformGradientBox.cpp @@ -33,7 +33,7 @@ TransformGradientBox::TransformGradientBox(CanvasView* view, Gradient* gradient, fGradient(gradient) { if (fShape) { - fShape->Acquire(); + fShape->AcquireReference(); fShape->AddObserver(this); } if (fGradient) { @@ -50,7 +50,7 @@ TransformGradientBox::~TransformGradientBox() { if (fShape) { fShape->RemoveObserver(this); - fShape->Release(); + fShape->ReleaseReference(); } if (fGradient) fGradient->RemoveObserver(this); diff --git a/src/apps/icon-o-matic/transformable/TransformGradientCommand.cpp b/src/apps/icon-o-matic/transformable/TransformGradientCommand.cpp index e7f60f9168..b01611ed82 100644 --- a/src/apps/icon-o-matic/transformable/TransformGradientCommand.cpp +++ b/src/apps/icon-o-matic/transformable/TransformGradientCommand.cpp @@ -27,7 +27,7 @@ TransformGradientCommand::TransformGradientCommand(TransformBox* box, if (fGradient == NULL) return; -// fGradient->Acquire(); + fGradient->AcquireReference(); if (fTransformBox != NULL) fTransformBox->AddListener(this); @@ -36,8 +36,8 @@ TransformGradientCommand::TransformGradientCommand(TransformBox* box, TransformGradientCommand::~TransformGradientCommand() { -// if (fGradient != NULL) -// fGradient->Release(); + if (fGradient != NULL) + fGradient->ReleaseReference(); if (fTransformBox != NULL) fTransformBox->RemoveListener(this); diff --git a/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp b/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp index 9668c56bf2..c3f2c665c8 100644 --- a/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp +++ b/src/apps/icon-o-matic/transformable/TransformPointsBox.cpp @@ -31,7 +31,7 @@ TransformPointsBox::TransformPointsBox(CanvasView* view, fCount(count), fPoints(count > 0 ? new (nothrow) control_point[count] : NULL) { - fPath->Acquire(); + fPath->AcquireReference(); BRect bounds(0, 0, -1, -1); @@ -70,7 +70,7 @@ TransformPointsBox::~TransformPointsBox() { delete[] fIndices; delete[] fPoints; - fPath->Release(); + fPath->ReleaseReference(); } // #pragma mark - diff --git a/src/apps/icon-o-matic/transformable/TransformShapesBox.cpp b/src/apps/icon-o-matic/transformable/TransformShapesBox.cpp index 975a350694..43ce1c50ac 100644 --- a/src/apps/icon-o-matic/transformable/TransformShapesBox.cpp +++ b/src/apps/icon-o-matic/transformable/TransformShapesBox.cpp @@ -40,7 +40,7 @@ TransformShapesBox::TransformShapesBox(CanvasView* view, for (int32 i = 0; i < fCount; i++) { if (fShapes[i]) { - fShapes[i]->Acquire(); + fShapes[i]->AcquireReference(); fShapes[i]->AddObserver(this); } } @@ -59,7 +59,7 @@ TransformShapesBox::~TransformShapesBox() for (int32 i = 0; i < fCount; i++) { if (fShapes[i]) { fShapes[i]->RemoveObserver(this); - fShapes[i]->Release(); + fShapes[i]->ReleaseReference(); } } delete[] fShapes; diff --git a/src/libs/icon/Icon.h b/src/libs/icon/Icon.h index 3d2cbeaa72..deb890648f 100644 --- a/src/libs/icon/Icon.h +++ b/src/libs/icon/Icon.h @@ -14,9 +14,9 @@ #ifdef ICON_O_MATIC # include +# include # include "Observer.h" -# include "Referenceable.h" #else # include #endif @@ -43,7 +43,7 @@ class IconListener { #ifdef ICON_O_MATIC class Icon : public ShapeContainerListener, public Observer, - public Referenceable { + public BReferenceable { #else class Icon { #endif diff --git a/src/libs/icon/shape/PathContainer.cpp b/src/libs/icon/shape/PathContainer.cpp index 71541ee84f..b9b9fcfa7c 100644 --- a/src/libs/icon/shape/PathContainer.cpp +++ b/src/libs/icon/shape/PathContainer.cpp @@ -179,7 +179,7 @@ PathContainer::_MakeEmpty() #ifdef ICON_O_MATIC _NotifyPathRemoved(path); if (fOwnsPaths) - path->Release(); + path->ReleaseReference(); #else if (fOwnsPaths) delete path; diff --git a/src/libs/icon/shape/Shape.cpp b/src/libs/icon/shape/Shape.cpp index 68352b1c76..3c4eaed60a 100644 --- a/src/libs/icon/shape/Shape.cpp +++ b/src/libs/icon/shape/Shape.cpp @@ -335,7 +335,7 @@ Shape::ObjectChanged(const Observable* object) void Shape::PathAdded(VectorPath* path, int32 index) { - path->Acquire(); + path->AcquireReference(); path->AddListener(this); _NotifyRerender(); } @@ -346,7 +346,7 @@ Shape::PathRemoved(VectorPath* path) { path->RemoveListener(this); _NotifyRerender(); - path->Release(); + path->ReleaseReference(); } // #pragma mark - @@ -417,7 +417,7 @@ Shape::SetStyle(::Style* style) #ifdef ICON_O_MATIC if (fStyle) { fStyle->RemoveObserver(this); - fStyle->Release(); + fStyle->ReleaseReference(); } ::Style* oldStyle = fStyle; #endif @@ -426,7 +426,7 @@ Shape::SetStyle(::Style* style) #ifdef ICON_O_MATIC if (fStyle) { - fStyle->Acquire(); + fStyle->AcquireReference(); fStyle->AddObserver(this); } diff --git a/src/libs/icon/shape/ShapeContainer.cpp b/src/libs/icon/shape/ShapeContainer.cpp index e9d419177c..f347338fb6 100644 --- a/src/libs/icon/shape/ShapeContainer.cpp +++ b/src/libs/icon/shape/ShapeContainer.cpp @@ -187,7 +187,7 @@ ShapeContainer::_MakeEmpty() Shape* shape = ShapeAtFast(i); #ifdef ICON_O_MATIC _NotifyShapeRemoved(shape); - shape->Release(); + shape->ReleaseReference(); #else delete shape; #endif diff --git a/src/libs/icon/style/GradientTransformable.cpp b/src/libs/icon/style/GradientTransformable.cpp index 5baf553b72..0ce4c3f739 100644 --- a/src/libs/icon/style/GradientTransformable.cpp +++ b/src/libs/icon/style/GradientTransformable.cpp @@ -22,6 +22,7 @@ Gradient::Gradient(bool empty) #ifdef ICON_O_MATIC : BArchivable(), Observable(), + BReferenceable(), Transformable(), #else : Transformable(), @@ -43,6 +44,7 @@ Gradient::Gradient(BMessage* archive) #ifdef ICON_O_MATIC : BArchivable(archive), Observable(), + BReferenceable(), Transformable(), #else : Transformable(), @@ -89,6 +91,7 @@ Gradient::Gradient(const Gradient& other) #ifdef ICON_O_MATIC : BArchivable(other), Observable(), + BReferenceable(), Transformable(other), #else : Transformable(other), diff --git a/src/libs/icon/style/GradientTransformable.h b/src/libs/icon/style/GradientTransformable.h index dff779f6b9..42fc93ae71 100644 --- a/src/libs/icon/style/GradientTransformable.h +++ b/src/libs/icon/style/GradientTransformable.h @@ -11,6 +11,7 @@ #ifdef ICON_O_MATIC # include +# include # include "Observable.h" #endif // ICON_O_MATIC @@ -45,6 +46,7 @@ _BEGIN_ICON_NAMESPACE #ifdef ICON_O_MATIC class Gradient : public BArchivable, public Observable, + public BReferenceable, public Transformable { #else class Gradient : public Transformable { diff --git a/src/libs/icon/style/Style.cpp b/src/libs/icon/style/Style.cpp index 3b621bace0..0e997f2218 100644 --- a/src/libs/icon/style/Style.cpp +++ b/src/libs/icon/style/Style.cpp @@ -223,7 +223,12 @@ Style::SetGradient(const ::Gradient* gradient) #endif delete[] fColors; delete[] fGammaCorrectedColors; +#ifdef ICON_O_MATIC + if (fGradient != NULL) + fGradient->ReleaseReference(); +#else delete fGradient; +#endif fColors = NULL; fGammaCorrectedColors = NULL; fGradient = NULL; diff --git a/src/libs/icon/style/StyleContainer.cpp b/src/libs/icon/style/StyleContainer.cpp index 8431c8ca0e..0926830d95 100644 --- a/src/libs/icon/style/StyleContainer.cpp +++ b/src/libs/icon/style/StyleContainer.cpp @@ -180,7 +180,7 @@ StyleContainer::_MakeEmpty() Style* style = StyleAtFast(i); #ifdef ICON_O_MATIC _NotifyStyleRemoved(style); - style->Release(); + style->ReleaseReference(); #else delete style; #endif