Code

fix wrong modified signal handling: connecting was sigc but disconnecting was old...
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 2 Jul 2007 19:04:27 +0000 (19:04 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 2 Jul 2007 19:04:27 +0000 (19:04 +0000)
src/sp-filter.cpp
src/sp-filter.h

index 11aa30e0bc37d8d2bc74b70cd10b38d1ffa2b1e2..aae143e8d608b594bcbd0673d558d91517503972 100644 (file)
@@ -111,6 +111,8 @@ sp_filter_init(SPFilter *filter)
     filter->_renderer = NULL;
     
     filter->_image_name = map<gchar *, int, ltstr>();
+
+    new (&filter->modified_connection) sigc::connection();
 }
 
 /**
@@ -156,14 +158,14 @@ sp_filter_release(SPObject *object)
 
     //release href
     if (filter->href) {
-        if (filter->href->getObject()) {
-            sp_signal_disconnect_by_data(filter->href->getObject(), filter);
-        }
+        filter->modified_connection.disconnect();
         filter->href->detach();
         delete filter->href;
         filter->href = NULL;
     }
 
+    filter->modified_connection.~connection();
+
     if (((SPObjectClass *) filter_parent_class)->release)
         ((SPObjectClass *) filter_parent_class)->release(object);
 }
@@ -352,13 +354,13 @@ static void
 filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter)
 {
     if (old_ref) {
-        sp_signal_disconnect_by_data(old_ref, filter);
+        filter->modified_connection.disconnect();
     }
     if ( SP_IS_FILTER(ref)
          && ref != filter )
     {
-        ref->connectModified(sigc::bind(sigc::ptr_fun(&filter_ref_modified), filter));
-        //g_signal_connect(G_OBJECT(ref), "modified", G_CALLBACK(filter_ref_modified), filter);
+        filter->modified_connection = 
+            ref->connectModified(sigc::bind(sigc::ptr_fun(&filter_ref_modified), filter));
     }
 
     filter_ref_modified(ref, 0, filter);
index c6edc6c65caf8407033c91b8f86056e0aac619e5..9c4e7aaf6e405625beb1cad2ab9853e23836de64 100644 (file)
@@ -56,6 +56,7 @@ struct SPFilter : public SPObject {
     NumberOptNumber filterRes;
     /** HREF attribute */
     SPFilterReference *href;
+    sigc::connection modified_connection;
 
     NR::Filter *_renderer;