summaryrefslogtreecommitdiffstats
path: root/src/object/sp-shape.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2019-10-18 12:54:47 +0000
committerTavmjong Bah <tavmjong@free.fr>2019-10-18 12:54:47 +0000
commitca8f8f8e647393e937e4c8f7ff5a029d30fbbd18 (patch)
tree252dba87bab464165633210f892fd4c8a9a578c9 /src/object/sp-shape.cpp
parentfix heap-use-after-free (diff)
downloadinkscape-ca8f8f8e647393e937e4c8f7ff5a029d30fbbd18.tar.gz
inkscape-ca8f8f8e647393e937e4c8f7ff5a029d30fbbd18.zip
Make href and unhref member functions of SPObject.
Diffstat (limited to 'src/object/sp-shape.cpp')
-rw-r--r--src/object/sp-shape.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp
index 30e841dc0..c186b176c 100644
--- a/src/object/sp-shape.cpp
+++ b/src/object/sp-shape.cpp
@@ -92,7 +92,8 @@ void SPShape::release() {
this->_release_connect[i].disconnect();
this->_modified_connect[i].disconnect();
- _marker[i] = static_cast<SPMarker *>(sp_object_hunref(_marker[i], this));
+ _marker[i]->unhrefObject(this);
+ _marker[i] = nullptr;
}
}
@@ -1002,7 +1003,8 @@ sp_shape_marker_release (SPObject *marker, SPShape *shape)
/* Detach marker */
shape->_release_connect[i].disconnect();
shape->_modified_connect[i].disconnect();
- shape->_marker[i] = static_cast<SPMarker *>(sp_object_hunref(shape->_marker[i], item));
+ shape->_marker[i]->unhrefObject(item);
+ shape->_marker[i] = nullptr;
}
}
}
@@ -1051,10 +1053,12 @@ sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value)
}
/* Unref marker */
- shape->_marker[key] = static_cast<SPMarker *>(sp_object_hunref(shape->_marker[key], object));
+ shape->_marker[key]->unhrefObject(object);
+ shape->_marker[key] = nullptr;
}
if (marker) {
- shape->_marker[key] = static_cast<SPMarker *>(sp_object_href(marker, object));
+ shape->_marker[key] = marker;
+ shape->_marker[key]->hrefObject(object);
shape->_release_connect[key] = marker->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_shape_marker_release), shape));
shape->_modified_connect[key] = marker->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_shape_marker_modified), shape));
}