Fixed bugs in reference counting. The transform boxen need to acquire refs to
the objects they transform. Fixes ticket #4536. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33170 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -31,6 +31,8 @@ TransformPointsBox::TransformPointsBox(CanvasView* view,
|
||||
fCount(count),
|
||||
fPoints(count > 0 ? new (nothrow) control_point[count] : NULL)
|
||||
{
|
||||
fPath->Acquire();
|
||||
|
||||
BRect bounds(0, 0, -1, -1);
|
||||
|
||||
if (fPoints && fIndices) {
|
||||
@@ -68,6 +70,7 @@ TransformPointsBox::~TransformPointsBox()
|
||||
{
|
||||
delete[] fIndices;
|
||||
delete[] fPoints;
|
||||
fPath->Release();
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
@@ -31,7 +31,7 @@ TransformShapesBox::TransformShapesBox(CanvasView* view,
|
||||
|
||||
fParentTransform()
|
||||
{
|
||||
if (fShapes) {
|
||||
if (fShapes != NULL) {
|
||||
// allocate storage for the current transformations
|
||||
// of each object
|
||||
fOriginals = new double[fCount * Transformable::matrix_size];
|
||||
@@ -39,8 +39,10 @@ TransformShapesBox::TransformShapesBox(CanvasView* view,
|
||||
memcpy(fShapes, shapes, fCount * sizeof(Shape*));
|
||||
|
||||
for (int32 i = 0; i < fCount; i++) {
|
||||
if (fShapes[i])
|
||||
if (fShapes[i]) {
|
||||
fShapes[i]->Acquire();
|
||||
fShapes[i]->AddObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
// trigger init
|
||||
@@ -55,8 +57,10 @@ TransformShapesBox::~TransformShapesBox()
|
||||
{
|
||||
if (fShapes) {
|
||||
for (int32 i = 0; i < fCount; i++) {
|
||||
if (fShapes[i])
|
||||
if (fShapes[i]) {
|
||||
fShapes[i]->RemoveObserver(this);
|
||||
fShapes[i]->Release();
|
||||
}
|
||||
}
|
||||
delete[] fShapes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user