[haiku-commits] haiku: hrev49158 - in src/apps/icon-o-matic: generic/support gui style transformable .

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 9 May 2015 21:41:38 +0200 (CEST)

hrev49158 adds 1 changeset to branch 'master'
old head: 8f1823774c598d2d4b29d5a2a602b8c1c79096d0
new head: 0cbb6c11eec74201f566920c90ebd2c5546b7aa6
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=0cbb6c11eec7+%5E8f1823774c59

----------------------------------------------------------------------------

0cbb6c11eec7: 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.

[ Stephan Aßmus <superstippi@xxxxxx> ]

----------------------------------------------------------------------------

Revision: hrev49158
Commit: 0cbb6c11eec74201f566920c90ebd2c5546b7aa6
URL: http://cgit.haiku-os.org/haiku/commit/?id=0cbb6c11eec7
Author: Stephan Aßmus <superstippi@xxxxxx>
Date: Sat May 9 19:38:15 2015 UTC

Ticket: https://dev.haiku-os.org/ticket/12033

----------------------------------------------------------------------------

36 files changed, 79 insertions(+), 167 deletions(-)
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 --------------------
.../icon-o-matic/generic/support/Referenceable.h | 27 -------
src/apps/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 +-
src/apps/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 +-
src/apps/icon-o-matic/style/AddStylesCommand.cpp | 2 +-
.../icon-o-matic/style/AssignStyleCommand.cpp | 8 +-
.../icon-o-matic/style/RemoveStylesCommand.cpp | 2 +-
.../icon-o-matic/style/SetGradientCommand.cpp | 7 +-
.../transformable/TransformGradientBox.cpp | 4 +-
.../transformable/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 +-

----------------------------------------------------------------------------

diff --git a/src/apps/icon-o-matic/Jamfile b/src/apps/icon-o-matic/Jamfile
index 2a0be6e..3e8f895 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 2b090a0..9f2dee2 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 e44ef85..c78ae8c 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 68d87e9..9ba83f8 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 751b236..77c93f3 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 <Referenceable.h>
#include <String.h>

#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 15958e8..0000000
--- 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 <bpmagic@xxxxxxxxxxxxxxx>
- * Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
- * Stephan Aßmus <superstippi@xxxxxx>
- */
-
-#include "Referenceable.h"
-
-#define TRACE 0
-
-#if TRACE
-#define ICON 1
-#include <debugger.h>
-#include <stdio.h>
-
-#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<IconObject*>(this);
-//printf("Referenceable::Release() - %s: %ld\n",
-// object ? object->Name() : "unkown", fReferenceCount);
-// } else
-//#endif
- if (old == 1) {
-#if ICON
-IconObject* object = dynamic_cast<IconObject*>(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 6539324..0000000
--- 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 <bpmagic@xxxxxxxxxxxxxxx>
- * Axel Dörfler, axeld@xxxxxxxxxxxxxxxx
- * Stephan Aßmus <superstippi@xxxxxx>
- */
-#ifndef REFERENCABLE_H
-#define REFERENCABLE_H
-
-#include <SupportDefs.h>
-
-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 d017d54..09ef633 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 b0c0222..61a3d27 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 91e9b3b..d536a73 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 7cd7808..a5a49d8 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 db64c16..e0229a8 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 b485713..cf5b3a1 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 34f712f..39fd6d5 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 4e50c11..62909f9 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 6ded3dd..9e49364 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 4417130..bb30005 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 9236a1f..c1a69c9 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 f826569..e54682e 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 8d2a5de..299fd85 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 46d73bb..a936bdd 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 8a3a56b..90f2a92 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 a4134f7..b29020e 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 97422bb..e966368 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 fc207ce..2b1c910 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 e7f60f9..b01611e 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 9668c56..c3f2c66 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 975a350..43ce1c5 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 3d2cbea..deb8906 100644
--- a/src/libs/icon/Icon.h
+++ b/src/libs/icon/Icon.h
@@ -14,9 +14,9 @@

#ifdef ICON_O_MATIC
# include <List.h>
+# include <Referenceable.h>

# include "Observer.h"
-# include "Referenceable.h"
#else
# include <SupportDefs.h>
#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 71541ee..b9b9fcf 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 68352b1..3c4eaed 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 e9d4191..f347338 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 5baf553..0ce4c3f 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 dff779f..42fc93a 100644
--- a/src/libs/icon/style/GradientTransformable.h
+++ b/src/libs/icon/style/GradientTransformable.h
@@ -11,6 +11,7 @@

#ifdef ICON_O_MATIC
# include <Archivable.h>
+# include <Referenceable.h>

# 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 3b621ba..0e997f2 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 8431c8c..0926830 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


Other related posts:

  • » [haiku-commits] haiku: hrev49158 - in src/apps/icon-o-matic: generic/support gui style transformable . - superstippi