* Fixed a leak reference
authorSergio Villar Senin <svillar@igalia.com>
Fri, 7 Sep 2007 14:47:21 +0000 (14:47 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 7 Sep 2007 14:47:21 +0000 (14:47 +0000)
* Added a g_object_ref because otherwise we're unreferencing too much the transport accounts and this caused a SIGSEV when finalizing the account store

pmo-trunk-r3244

src/modest-runtime.c
src/modest-tny-account-store.c

index 7bda85d..cb99869 100644 (file)
@@ -192,8 +192,9 @@ modest_runtime_get_send_queue  (TnyTransportAccount *account)
                 * as soon as it is instantiated: */
                send_queue = (gpointer)modest_tny_send_queue_new (TNY_CAMEL_TRANSPORT_ACCOUNT(account));
 
-               g_hash_table_insert (send_queue_cache, account, send_queue);
-               g_object_ref (send_queue);
+               g_hash_table_insert (send_queue_cache, 
+                                    g_object_ref (account), 
+                                    g_object_ref (send_queue));
        }
 
        return MODEST_TNY_SEND_QUEUE(send_queue);
index 88a38ee..74f077a 100644 (file)
@@ -859,7 +859,8 @@ modest_tny_account_store_finalize (GObject *obj)
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
-gboolean volume_path_is_mounted (const gchar* path)
+gboolean 
+volume_path_is_mounted (const gchar* path)
 {
        g_return_val_if_fail (path, FALSE);
 
@@ -1571,6 +1572,7 @@ insert_account (ModestTnyAccountStore *self,
 
                /* Add account to the list */
                tny_list_append (priv->transport_accounts, G_OBJECT (transport_account));
+               g_assert (TNY_IS_ACCOUNT (transport_account));
 
                /* Add connection-specific transport accounts */
                add_connection_specific_transport_accounts (self);
@@ -1730,6 +1732,7 @@ add_connection_specific_transport_accounts (ModestTnyAccountStore *self)
                                                           (gpointer)self);
 
                                        tny_list_append (priv->transport_accounts, G_OBJECT (tny_account));
+                                       g_object_unref (tny_account);
                                } else
                                        g_printerr ("modest: failed to create smtp-specific account for %s\n",
                                                    transport_account_name);