From: buliabyak Date: Mon, 6 Feb 2006 01:56:17 +0000 (+0000) Subject: yet another fix along the same lines: disconnect listeners if they have been connecte... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=463eeb2cd4e8d64a0dab616f768a0762f731c734;p=inkscape.git yet another fix along the same lines: disconnect listeners if they have been connected, checking a flag instead of relying on style->object --- diff --git a/src/style.cpp b/src/style.cpp index 9dd950361..e0a1dcc7d 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -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; diff --git a/src/style.h b/src/style.h index ba1900bde..333344ad9 100644 --- a/src/style.h +++ b/src/style.h @@ -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();