aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-store.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r--camel/providers/imap/camel-imap-store.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index eecc7b0e35..a86a3b51e7 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -872,12 +872,14 @@ get_folder_online (CamelStore *store, const char *folder_name,
g_free (folder_dir);
if (new_folder) {
imap_store->current_folder = new_folder;
+ camel_object_ref (CAMEL_OBJECT (new_folder));
camel_imap_folder_selected (new_folder, response, ex);
if (camel_exception_is_set (ex)) {
+ camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
+ imap_store->current_folder = NULL;
camel_object_unref (CAMEL_OBJECT (new_folder));
- new_folder = imap_store->current_folder = NULL;
- } else
- camel_object_ref (CAMEL_OBJECT (imap_store->current_folder));
+ new_folder = NULL;
+ }
}
camel_imap_response_free_without_processing (imap_store, response);