From: Jim Evins Date: Sat, 30 Nov 2002 00:11:31 +0000 (+0000) Subject: Disconnect callbacks that reference the properties dialog when it is destroyed. X-Git-Tag: glabels-2_3_0~694 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8630930291f7555b2bbeeafb20f5a7ae25629933;p=glabels Disconnect callbacks that reference the properties dialog when it is destroyed. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@193 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c index 40020853..70048b91 100644 --- a/glabels2/src/view-barcode.c +++ b/glabels2/src/view-barcode.c @@ -375,6 +375,8 @@ response_cb (GtkDialog *dialog, gint response, glViewBarcode *view_barcode) { + glLabelObject *object; + gl_debug (DEBUG_VIEW, "START"); g_return_if_fail(dialog != NULL); @@ -385,6 +387,13 @@ response_cb (GtkDialog *dialog, gtk_widget_hide (GTK_WIDGET(dialog)); break; case GTK_RESPONSE_DELETE_EVENT: + /* Dialog destroyed, remove callbacks that reference it. */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode)); + + g_signal_handlers_disconnect_by_func (object, update_dialog_cb, + view_barcode); + g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb, + view_barcode); break; default: g_print ("response = %d", response); diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c index d4a64693..3f0215ad 100644 --- a/glabels2/src/view-box.c +++ b/glabels2/src/view-box.c @@ -385,17 +385,28 @@ response_cb (GtkDialog *dialog, gint response, glViewBox *view_box) { + glLabelObject *object; + gl_debug (DEBUG_VIEW, "START"); g_return_if_fail(dialog != NULL); g_return_if_fail(GTK_IS_DIALOG(dialog)); switch(response) { + case GTK_RESPONSE_CLOSE: gtk_widget_hide (GTK_WIDGET(dialog)); break; + case GTK_RESPONSE_DELETE_EVENT: + /* Dialog destroyed, remove callbacks that reference it. */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box)); + + g_signal_handlers_disconnect_by_func (object, update_dialog_cb, view_box); + g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb, + view_box); break; + default: g_print ("response = %d", response); g_assert_not_reached (); diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c index 36d4fcc2..00e1f18b 100644 --- a/glabels2/src/view-ellipse.c +++ b/glabels2/src/view-ellipse.c @@ -386,6 +386,8 @@ response_cb (GtkDialog *dialog, gint response, glViewEllipse *view_ellipse) { + glLabelObject *object; + gl_debug (DEBUG_VIEW, "START"); g_return_if_fail(dialog != NULL); @@ -396,6 +398,13 @@ response_cb (GtkDialog *dialog, gtk_widget_hide (GTK_WIDGET(dialog)); break; case GTK_RESPONSE_DELETE_EVENT: + /* Dialog destroyed, remove callbacks that reference it. */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse)); + + g_signal_handlers_disconnect_by_func (object, update_dialog_cb, + view_ellipse); + g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb, + view_ellipse); break; default: g_print ("response = %d", response); diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c index 05073e1a..e4f17c70 100644 --- a/glabels2/src/view-image.c +++ b/glabels2/src/view-image.c @@ -384,6 +384,8 @@ response_cb (GtkDialog *dialog, gint response, glViewImage *view_image) { + glLabelObject *object; + gl_debug (DEBUG_VIEW, "START"); g_return_if_fail(dialog != NULL); @@ -394,6 +396,13 @@ response_cb (GtkDialog *dialog, gtk_widget_hide (GTK_WIDGET(dialog)); break; case GTK_RESPONSE_DELETE_EVENT: + /* Dialog destroyed, remove callbacks that reference it. */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image)); + + g_signal_handlers_disconnect_by_func (object, update_dialog_cb, + view_image); + g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb, + view_image); break; default: g_print ("response = %d", response); diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c index 7d4d8588..0bf83e44 100644 --- a/glabels2/src/view-line.c +++ b/glabels2/src/view-line.c @@ -370,6 +370,8 @@ response_cb (GtkDialog *dialog, gint response, glViewLine *view_line) { + glLabelObject *object; + gl_debug (DEBUG_VIEW, "START"); g_return_if_fail(dialog != NULL); @@ -380,6 +382,13 @@ response_cb (GtkDialog *dialog, gtk_widget_hide (GTK_WIDGET(dialog)); break; case GTK_RESPONSE_DELETE_EVENT: + /* Dialog destroyed, remove callbacks that reference it. */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line)); + + g_signal_handlers_disconnect_by_func (object, update_dialog_cb, + view_line); + g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb, + view_line); break; default: g_print ("response = %d", response); diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index 851cec71..4e60eda6 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -349,6 +349,8 @@ response_cb (GtkDialog *dialog, gint response, glViewText *view_text) { + glLabelObject *object; + gl_debug (DEBUG_VIEW, "START"); g_return_if_fail(dialog != NULL); @@ -359,6 +361,13 @@ response_cb (GtkDialog *dialog, gtk_widget_hide (GTK_WIDGET(dialog)); break; case GTK_RESPONSE_DELETE_EVENT: + /* Dialog destroyed, remove callbacks that reference it. */ + object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text)); + + g_signal_handlers_disconnect_by_func (object, update_dialog_cb, + view_text); + g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb, + view_text); break; default: g_print ("response = %d", response);