[evolution-data-server] Fix a ref/unref imbalance of CamelIMAPXStoreInfo



commit c1c525009c9a12003d4440e1228ebc32ef7ecfb0
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jan 27 11:04:03 2017 +0100

    Fix a ref/unref imbalance of CamelIMAPXStoreInfo

 .../providers/imapx/camel-imapx-store-summary.c    |    9 +++++----
 src/camel/providers/imapx/camel-imapx-store.c      |    4 ++++
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-store-summary.c 
b/src/camel/providers/imapx/camel-imapx-store-summary.c
index 6b0158e..0b43863 100644
--- a/src/camel/providers/imapx/camel-imapx-store-summary.c
+++ b/src/camel/providers/imapx/camel-imapx-store-summary.c
@@ -323,6 +323,8 @@ camel_imapx_store_summary_mailbox (CamelStoreSummary *summary,
        return (CamelIMAPXStoreInfo *) match;
 }
 
+/* The returned CamelIMAPXStoreInfo is referenced, unref it with
+   camel_store_summary_info_unref() when no longer needed */
 CamelIMAPXStoreInfo *
 camel_imapx_store_summary_add_from_mailbox (CamelStoreSummary *summary,
                                             CamelIMAPXMailbox *mailbox)
@@ -339,11 +341,8 @@ camel_imapx_store_summary_add_from_mailbox (CamelStoreSummary *summary,
        separator = camel_imapx_mailbox_get_separator (mailbox);
 
        info = camel_imapx_store_summary_mailbox (summary, mailbox_name);
-       if (info != NULL) {
-               camel_store_summary_info_unref (
-                       summary, (CamelStoreInfo *) info);
+       if (info != NULL)
                return info;
-       }
 
        folder_path = camel_imapx_mailbox_to_folder_path (
                mailbox_name, separator);
@@ -355,6 +354,8 @@ camel_imapx_store_summary_add_from_mailbox (CamelStoreSummary *summary,
 
        g_return_val_if_fail (info != NULL, NULL);
 
+       camel_store_summary_info_ref (summary, (CamelStoreInfo *) info);
+
        info->mailbox_name = g_strdup (mailbox_name);
        info->separator = separator;
 
diff --git a/src/camel/providers/imapx/camel-imapx-store.c b/src/camel/providers/imapx/camel-imapx-store.c
index 4bdde58..f070b70 100644
--- a/src/camel/providers/imapx/camel-imapx-store.c
+++ b/src/camel/providers/imapx/camel-imapx-store.c
@@ -503,6 +503,8 @@ imapx_store_process_mailbox_attributes (CamelIMAPXStore *store,
        folder_path = camel_imapx_mailbox_to_folder_path (mailbox_name, separator);
        fi = imapx_store_build_folder_info (store, folder_path, (CamelFolderInfoFlags) flags);
 
+       camel_store_summary_info_unref (store->summary, (CamelStoreInfo *) si);
+
        /* Figure out which signals to emit, if any. */
        if (use_subscriptions || camel_imapx_namespace_get_category (camel_imapx_mailbox_get_namespace 
(mailbox)) != CAMEL_IMAPX_NAMESPACE_PERSONAL) {
                /* If we are honoring folder subscriptions, then
@@ -1258,6 +1260,8 @@ collect_folder_info_for_list (CamelIMAPXStore *imapx_store,
 
        /* Takes ownership of the CamelFolderInfo. */
        g_hash_table_insert (folder_info_results, g_strdup (mailbox_name), fi);
+
+       camel_store_summary_info_unref (imapx_store->summary, (CamelStoreInfo *) si);
 }
 
 static gboolean


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