From 0b7cf610418a158313ee7868fc62725d974b5432 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Thu, 21 Aug 2008 17:16:42 +0000 Subject: [PATCH] * Fixes a memory leak * Fixes a critical destroying a banner already destroyed pmo-trunk-r5343 --- src/maemo/modest-main-window.c | 36 ++++++++++++++++++++++++++++++++++++ src/modest-tny-account.c | 10 ++++++++-- src/modest-tny-send-queue.c | 2 ++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index bf8caa5..5025c92 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -2894,6 +2894,17 @@ modest_main_window_on_msg_view_window_msg_changed (ModestMsgViewWindow *view_win return TRUE; } +static void +updating_banner_destroyed (gpointer data, + GObject *where_the_object_was) +{ + ModestMainWindowPrivate *priv = NULL; + + priv = MODEST_MAIN_WINDOW_GET_PRIVATE (data); + + priv->updating_banner = NULL; +} + static gboolean show_updating_banner (gpointer user_data) { @@ -2908,6 +2919,13 @@ show_updating_banner (gpointer user_data) priv->updating_banner = modest_platform_animation_banner (GTK_WIDGET (user_data), NULL, _CS ("ckdg_pb_updating")); + + /* We need this because banners in Maemo could be + destroyed by dialogs so we need to properly update + our reference to it */ + g_object_weak_ref (G_OBJECT (priv->updating_banner), + updating_banner_destroyed, + user_data); gdk_threads_leave (); } @@ -3033,6 +3051,17 @@ on_window_destroy (GtkObject *widget, remove_banners (MODEST_MAIN_WINDOW (widget)); } +static void +retrieving_banner_destroyed (gpointer data, + GObject *where_the_object_was) +{ + ModestMainWindowPrivate *priv = NULL; + + priv = MODEST_MAIN_WINDOW_GET_PRIVATE (data); + + priv->retrieving_banner = NULL; +} + static gboolean show_retrieving_banner (gpointer user_data) { @@ -3047,6 +3076,13 @@ show_retrieving_banner (gpointer user_data) priv->retrieving_banner = modest_platform_animation_banner (GTK_WIDGET (user_data), NULL, _("mcen_ib_getting_items")); + + /* We need this because banners in Maemo could be + destroyed by dialogs so we need to properly update + our reference to it */ + g_object_weak_ref (G_OBJECT (priv->retrieving_banner), + retrieving_banner_destroyed, + user_data); gdk_threads_leave (); } diff --git a/src/modest-tny-account.c b/src/modest-tny-account.c index bc270ac..84b5187 100644 --- a/src/modest-tny-account.c +++ b/src/modest-tny-account.c @@ -372,11 +372,17 @@ update_tny_account (TnyAccount *tny_account, if (modest_protocol_info_protocol_is_store(protocol) && (protocol == MODEST_PROTOCOL_STORE_IMAP) ) { + TnyPair *use_lsub, *check_all; + + use_lsub = tny_pair_new (MODEST_ACCOUNT_OPTION_USE_LSUB, ""); + check_all = tny_pair_new (MODEST_ACCOUNT_OPTION_CHECK_ALL, ""); /* Other connection options, needed for IMAP. */ tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (tny_account), - tny_pair_new (MODEST_ACCOUNT_OPTION_USE_LSUB, "")); + use_lsub); tny_camel_account_add_option (TNY_CAMEL_ACCOUNT (tny_account), - tny_pair_new (MODEST_ACCOUNT_OPTION_CHECK_ALL, "")); + check_all); + g_object_unref (use_lsub); + g_object_unref (check_all); } username = modest_server_account_settings_get_username (server_settings); diff --git a/src/modest-tny-send-queue.c b/src/modest-tny-send-queue.c index 6fe5ce0..3e1c916 100644 --- a/src/modest-tny-send-queue.c +++ b/src/modest-tny-send-queue.c @@ -399,6 +399,8 @@ modest_tny_send_queue_instance_init (GTypeInstance *instance, gpointer g_class) priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (instance); priv->queue = g_queue_new(); priv->current = NULL; + priv->outbox = NULL; + priv->sentbox = NULL; } static void -- 1.7.9.5