From 9bd1641646ba98139dcd1fac959165c871e0f979 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 24 Jan 2011 13:30:38 +0100 Subject: Various critical warnings about comp-editor-pages and date edit --- calendar/gui/dialogs/comp-editor.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index b62e5f2aa8..0115f85a0e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -1418,6 +1418,27 @@ comp_editor_get_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } +static void +unref_page_cb (gpointer editor_page, gpointer comp_editor) +{ + if (IS_COMP_EDITOR_PAGE (editor_page)) { + GtkWidget *page_widget; + CompEditorPage *page = COMP_EDITOR_PAGE (editor_page); + CompEditor *editor = COMP_EDITOR (comp_editor); + + g_return_if_fail (page != NULL); + g_return_if_fail (editor != NULL); + + page_widget = comp_editor_page_get_widget (page); + g_signal_handlers_disconnect_matched ( + page_widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page); + } + + g_signal_handlers_disconnect_matched ( + editor_page, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, comp_editor); + g_object_unref (editor_page); +} + static void comp_editor_dispose (GObject *object) { @@ -1464,7 +1485,7 @@ comp_editor_dispose (GObject *object) /* We want to destroy the pages after the widgets get destroyed, since they have lots of signal handlers connected to the widgets with the pages as the data. */ - g_list_foreach (priv->pages, (GFunc) g_object_unref, NULL); + g_list_foreach (priv->pages, (GFunc) unref_page_cb, object); g_list_free (priv->pages); priv->pages = NULL; @@ -2589,8 +2610,7 @@ page_unmapped_cb (GtkWidget *page_widget, return; if (page->accel_group) { - gtk_window_remove_accel_group (GTK_WINDOW (toplevel), - page->accel_group); + gtk_window_remove_accel_group (GTK_WINDOW (toplevel), page->accel_group); } } -- cgit