[evolution/wip/webkit2] Preferences window never freed



commit 8838ae45df53431453ede16ec746c9ae06f16c21
Author: Milan Crha <mcrha redhat com>
Date:   Fri Nov 13 17:54:40 2015 +0100

    Preferences window never freed
    
    The shell creates it on start and unrefs it on its dispose, but
    the window is not freed, it's still left in memory. The other parts
    are need too, otherwise runtime warnings are shown during the free
    of the preferences window.

 e-util/e-preferences-window.c   |    3 +++
 shell/e-shell.c                 |    8 +++++---
 smime/gui/certificate-manager.c |   10 ++++++----
 3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/e-util/e-preferences-window.c b/e-util/e-preferences-window.c
index d15b208..680140d 100644
--- a/e-util/e-preferences-window.c
+++ b/e-util/e-preferences-window.c
@@ -208,6 +208,9 @@ preferences_window_dispose (GObject *object)
        priv = E_PREFERENCES_WINDOW_GET_PRIVATE (object);
 
        if (priv->icon_view != NULL) {
+               g_signal_handlers_disconnect_by_func (priv->icon_view,
+                       G_CALLBACK (preferences_window_selection_changed_cb), object);
+
                g_object_unref (priv->icon_view);
                priv->icon_view = NULL;
        }
diff --git a/shell/e-shell.c b/shell/e-shell.c
index f21b128..11eb658 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -1416,7 +1416,11 @@ shell_dispose (GObject *object)
        g_clear_object (&priv->registry);
        g_clear_object (&priv->credentials_prompter);
        g_clear_object (&priv->client_cache);
-       g_clear_object (&priv->preferences_window);
+
+       if (priv->preferences_window) {
+               gtk_widget_destroy (priv->preferences_window);
+               priv->preferences_window = NULL;
+       }
 
        if (priv->preparing_for_line_change != NULL) {
                g_object_remove_weak_pointer (
@@ -1937,8 +1941,6 @@ e_shell_init (EShell *shell)
        shell->priv->backends_by_scheme = backends_by_scheme;
        shell->priv->safe_mode = e_file_lock_exists ();
 
-       g_object_ref_sink (shell->priv->preferences_window);
-
        /* Add our icon directory to the theme's search path
         * here instead of in main() so Anjal picks it up. */
        icon_theme = gtk_icon_theme_get_default ();
diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c
index cab4f06..793c8c4 100644
--- a/smime/gui/certificate-manager.c
+++ b/smime/gui/certificate-manager.c
@@ -1831,13 +1831,15 @@ free_cert (GtkTreeModel *model,
            gpointer user_data)
 {
        CertPage *cp = user_data;
-       ECert *cert;
+       ECert *cert = NULL;
 
        gtk_tree_model_get (model, iter, cp->columns_count - 1, &cert, -1);
 
-       /* Double unref: one for gtk_tree_model_get() and one for e_cert_new() */
-       g_object_unref (cert);
-       g_object_unref (cert);
+       if (cert) {
+               /* Double unref: one for gtk_tree_model_get() and one for e_cert_new() */
+               g_object_unref (cert);
+               g_object_unref (cert);
+       }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]