From e6578ce0f6538fa3d0dcb67a0e18a82c9029d7e6 Mon Sep 17 00:00:00 2001 From: bulia byak Date: Mon, 6 Feb 2006 01:56:17 +0000 Subject: yet another fix along the same lines: disconnect listeners if they have been connected, checking a flag instead of relying on style->object (bzr r85) --- src/style.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/style.cpp') 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; -- cgit v1.2.3