Fix regression after move to GSimpleAsyncResult in camel_service_disconnect
authorMilan Crha <mcrha@redhat.com>
Tue, 7 Aug 2012 17:04:39 +0000 (19:04 +0200)
committerMilan Crha <mcrha@redhat.com>
Tue, 7 Aug 2012 17:04:39 +0000 (19:04 +0200)
IMAP provider called disconnect in its finalize method, it was all fine
until move to GSimpleAsyncResult, which requires "live" GObject, which
is not true when called from finalize, thus everything breaks.
Moving the disconnect call to dispose function fixes this.
This was recognized when creating a new IMAP account and querying
for authentication methods.

camel/providers/imap/camel-imap-store.c

index db6422e..5d95e5c 100644 (file)
@@ -762,6 +762,10 @@ imap_store_dispose (GObject *object)
 {
        CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
 
+       /* This frees current_folder, folders, authtypes, streams, and namespace. */
+       camel_service_disconnect_sync (
+               CAMEL_SERVICE (imap_store), TRUE, NULL, NULL);
+
        if (imap_store->summary != NULL) {
                camel_store_summary_save (
                        CAMEL_STORE_SUMMARY (imap_store->summary));
@@ -778,10 +782,6 @@ imap_store_finalize (GObject *object)
 {
        CamelImapStore *imap_store = CAMEL_IMAP_STORE (object);
 
-       /* This frees current_folder, folders, authtypes, streams, and namespace. */
-       camel_service_disconnect_sync (
-               CAMEL_SERVICE (imap_store), TRUE, NULL, NULL);
-
        g_static_rec_mutex_free (&imap_store->command_and_response_lock);
        g_hash_table_destroy (imap_store->known_alerts);