* Partially fixes NB#83671, fixed a reference leak
authorSergio Villar Senin <svillar@igalia.com>
Fri, 11 Apr 2008 15:38:30 +0000 (15:38 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Fri, 11 Apr 2008 15:38:30 +0000 (15:38 +0000)
* Small fix to dumpAccounts

pmo-trunk-r4403

src/dbus_api/modest-dbus-callbacks.c
src/modest-tny-account-store.c
src/widgets/modest-folder-view.c

index 525d719..b545854 100644 (file)
@@ -956,7 +956,8 @@ on_dbus_method_dump_accounts (DBusConnection *con, DBusMessage *message)
                if (TNY_IS_ACCOUNT(acc)) {
                        gchar *tmp, *url = tny_account_get_url_string (acc);
                        tmp = g_strdup_printf ("%sstore    : '%s': %s (refs: %d)\n",
-                                              str, tny_account_get_id (acc), url, ((GObject*)acc)->ref_count);
+                                              str, tny_account_get_id (acc), url, 
+                                              ((GObject*)acc)->ref_count-1);
                        g_free (str);
                        str = tmp;
                        g_free (url);
@@ -970,7 +971,8 @@ on_dbus_method_dump_accounts (DBusConnection *con, DBusMessage *message)
                if (TNY_IS_ACCOUNT(acc)) {
                        gchar *tmp, *url = tny_account_get_url_string (acc);
                        tmp = g_strdup_printf ("%stransport: '%s': %s (refs: %d)\n",
-                                              str, tny_account_get_id (acc), url, ((GObject*)acc)->ref_count);
+                                              str, tny_account_get_id (acc), url, 
+                                              ((GObject*)acc)->ref_count-1);
                        g_free (str);
                        str = tmp;
                        g_free (url);
index d028b93..db9ac1d 100644 (file)
@@ -1002,7 +1002,7 @@ modest_tny_account_store_get_accounts  (TnyAccountStore *self,
                tny_list_foreach (priv->transport_accounts, foreach_account_append_to_list, list);
                break;
        case TNY_ACCOUNT_STORE_STORE_ACCOUNTS:
-               tny_list_foreach (priv->store_accounts, foreach_account_append_to_list, list);
+               tny_list_foreach (priv->store_accounts, foreach_account_append_to_list, list);
                break;
        case TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS:
                tny_list_foreach (priv->transport_accounts, foreach_account_append_to_list, list);
index 01a5754..05e18a8 100644 (file)
@@ -382,13 +382,8 @@ text_cell_data  (GtkTreeViewColumn *column,
                            TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
                            TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
                            -1);
-       if (!fname)
-               return;
-
-       if (!instance) {
-               g_free (fname);
-               return;
-       }
+       if (!fname || !instance)
+               goto end;
 
        ModestFolderView *self = MODEST_FOLDER_VIEW (data);
        priv =  MODEST_FOLDER_VIEW_GET_PRIVATE (self);
@@ -487,9 +482,11 @@ text_cell_data  (GtkTreeViewColumn *column,
                modest_tny_account_get_mmc_account_name (TNY_STORE_ACCOUNT (instance), 
                                                         on_get_mmc_account_name, callback_data);
        }
-                       
-       g_object_unref (G_OBJECT (instance));
-       g_free (fname);
+ end:                  
+       if (instance)
+               g_object_unref (G_OBJECT (instance));
+       if (fname)
+               g_free (fname);
 }
 
 
@@ -1585,7 +1582,7 @@ modest_folder_view_update_model (ModestFolderView *self,
        priv =  MODEST_FOLDER_VIEW_GET_PRIVATE(self);
        
        /* Notify that there is no folder selected */
-       g_signal_emit (G_OBJECT(self), 
+       g_signal_emit (G_OBJECT(self),
                       signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
                       NULL, FALSE);
        if (priv->cur_folder_store) {
@@ -1622,7 +1619,6 @@ modest_folder_view_update_model (ModestFolderView *self,
        g_signal_connect (G_OBJECT(filter_model), "row-inserted",
                          (GCallback) on_row_inserted_maybe_select_folder, self);
 
-
        g_object_unref (model);
        g_object_unref (filter_model);          
        g_object_unref (sortable);