From 98ac5336c29a9dc4300e04c89a6350f735e14ae5 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Tue, 12 Sep 2006 18:04:46 +0000 Subject: [PATCH] disconnect mask/ref connections when item is destroyed --- src/sp-item.cpp | 13 +++++++------ src/sp-item.h | 3 +++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 401af10b6..ff7857e6f 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -149,16 +149,14 @@ void SPItem::init() { this->display = NULL; this->clip_ref = new SPClipPathReference(this); - { - sigc::signal cs1=this->clip_ref->changedSignal(); - sigc::slot2 sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this); - cs1.connect(sl1); - } + sigc::signal cs1=this->clip_ref->changedSignal(); + sigc::slot2 sl1=sigc::bind(sigc::ptr_fun(clip_ref_changed), this); + _clip_ref_connection = cs1.connect(sl1); this->mask_ref = new SPMaskReference(this); sigc::signal cs2=this->mask_ref->changedSignal(); sigc::slot2 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; diff --git a/src/sp-item.h b/src/sp-item.h index cb34817e5..43d2d8aa3 100644 --- a/src/sp-item.h +++ b/src/sp-item.h @@ -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 slot) { return _transformed_signal.connect(slot); } -- 2.30.2