Code

yet another fix along the same lines: disconnect listeners if they have been connecte...
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 6 Feb 2006 01:56:17 +0000 (01:56 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 6 Feb 2006 01:56:17 +0000 (01:56 +0000)
src/style.cpp
src/style.h

index 9dd9503614f663e7172c7e41ec63459673ee3c0c..e0a1dcc7d2bdaad8a62f85d9c88e61c3baae2c5c 100644 (file)
@@ -390,6 +390,7 @@ sp_style_new()
 
     style->cloned = false;
     style->hreffed = false;
+    style->listening = false;
 
     return style;
 }
@@ -2009,6 +2010,7 @@ sp_style_merge_ipaint(SPStyle *style, SPIPaint *paint, SPIPaint const *parent)
                                      G_CALLBACK(sp_style_paint_server_release), style);
                     g_signal_connect(G_OBJECT(paint->value.paint.server), "modified",
                                      G_CALLBACK(sp_style_paint_server_modified), style);
+                    style->listening = true;
                 }
             }
             break;
@@ -2863,6 +2865,7 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
                                      G_CALLBACK(sp_style_paint_server_release), style);
                     g_signal_connect(G_OBJECT(paint->value.paint.server), "modified",
                                      G_CALLBACK(sp_style_paint_server_modified), style);
+                    style->listening = true;
                 }
             } else {
                 paint->value.paint.server = NULL;
@@ -3401,10 +3404,12 @@ sp_style_paint_clear(SPStyle *style, SPIPaint *paint,
     if (hunref && (paint->type == SP_PAINT_TYPE_PAINTSERVER) && paint->value.paint.server) {
         if (style->hreffed) {
             sp_object_hunref(SP_OBJECT(paint->value.paint.server), style);
+            style->hreffed = false;
         }
-        if (style->object || style->cloned) {
+        if (style->listening) {
             g_signal_handlers_disconnect_matched(G_OBJECT(paint->value.paint.server),
                                                  G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, style);
+            style->listening = false;
         }
         paint->value.paint.server = NULL;
         paint->value.paint.uri = NULL;
index ba1900bde8265103285729d3dcdaa61bdc4ef5bb..333344ad9b2fd280b21d645cc1b8805d56022a38 100644 (file)
@@ -323,6 +323,8 @@ struct SPStyle {
     bool cloned; 
     /// style has hreffed its paintservers, needs to release
     bool hreffed; 
+    /// style is listening to changes in paintservers, need to disconnect
+    bool listening; 
 };
 
 SPStyle *sp_style_new();