From 890f31bd076da194c5b7ea8022e72c8aad4a0de1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 13 Oct 2012 20:37:32 -0400 Subject: Bug 685786 - EWebView: Signal handlers never disconnected Both EWebView and EMailDisplay listen for "changed" signals from a GSettings instance, passing itself as the 'user_data' to the signal handler e_web_view_update_fonts(). But in both cases the signal handler was left connected after EWebView and EMailDisplay were finalized, resulting in the signal handler receiving a dangling pointer. Not using g_signal_connect_object() here because of the unresolved reference leak issue in GObject. The GSettings instance is likely cached internally and lives well beyond EWebView and EMailDisplay. --- mail/e-mail-display.c | 9 ++++++++- widgets/misc/e-web-view.c | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 82934ea642..5e33ccd570 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -1313,8 +1313,15 @@ mail_display_dispose (GObject *object) priv->widgets = NULL; } + if (priv->settings != NULL) { + g_signal_handlers_disconnect_matched ( + priv->settings, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); + g_object_unref (priv->settings); + priv->settings = NULL; + } + g_clear_object (&priv->part_list); - g_clear_object (&priv->settings); g_clear_object (&priv->formatter); /* Chain up to parent's dispose() method. */ diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index e1fb5c54a6..84c473dc37 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -803,11 +803,17 @@ web_view_dispose (GObject *object) } if (priv->aliasing_settings != NULL) { + g_signal_handlers_disconnect_matched ( + priv->aliasing_settings, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); g_object_unref (priv->aliasing_settings); priv->aliasing_settings = NULL; } if (priv->font_settings != NULL) { + g_signal_handlers_disconnect_matched ( + priv->font_settings, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); g_object_unref (priv->font_settings); priv->font_settings = NULL; } -- cgit v1.2.3