Code

disconnect mask/ref connections when item is destroyed
authorbuliabyak <buliabyak@users.sourceforge.net>
Tue, 12 Sep 2006 18:04:46 +0000 (18:04 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Tue, 12 Sep 2006 18:04:46 +0000 (18:04 +0000)
src/sp-item.cpp
src/sp-item.h

index 401af10b64dd812748292b575bb37683e27a7fac..ff7857e6fb273172b168150bfd1600cd04db5dae 100644 (file)
@@ -149,16 +149,14 @@ void SPItem::init() {
     this->display = NULL;
 
     this->clip_ref = new SPClipPathReference(this);
-               {
-                       sigc::signal<void, SPObject *, SPObject *> cs1=this->clip_ref->changedSignal();
-                       sigc::slot2<void,SPObject*, SPObject *> sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this);
-                       cs1.connect(sl1);
-               }
+               sigc::signal<void, SPObject *, SPObject *> cs1=this->clip_ref->changedSignal();
+               sigc::slot2<void,SPObject*, SPObject *> sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this);
+    _clip_ref_connection = cs1.connect(sl1);
 
     this->mask_ref = new SPMaskReference(this);
                sigc::signal<void, SPObject *, SPObject *> cs2=this->mask_ref->changedSignal();
                sigc::slot2<void,SPObject*, SPObject *> sl2=sigc::bind(sigc::ptr_fun(mask_ref_changed), this);
-    cs2.connect(sl2);
+    _mask_ref_connection = cs2.connect(sl2);
 
     if (!this->style) this->style = sp_style_new_from_object(this);
 
@@ -402,6 +400,9 @@ sp_item_release(SPObject *object)
 {
     SPItem *item = (SPItem *) object;
 
+    item->_clip_ref_connection.disconnect();
+    item->_mask_ref_connection.disconnect();
+
     if (item->clip_ref) {
         item->clip_ref->detach();
         delete item->clip_ref;
index cb34817e53bed9dcfe52b323a62ace2a7b1fc8a9..43d2d8aa3f67685d15c07077dccf5c4a2e2a1e98 100644 (file)
@@ -143,6 +143,9 @@ struct SPItem : public SPObject {
 
     NR::Rect invokeBbox(NR::Matrix const &transform) const;
 
+    sigc::connection _clip_ref_connection;
+    sigc::connection _mask_ref_connection;
+
     sigc::connection connectTransformed(sigc::slot<void, NR::Matrix const *, SPItem *> slot)  {
         return _transformed_signal.connect(slot);
     }