GtkAppChooserButton: avoid some leaks

gtk_tree_model_get() returns a reference for objects.
https://bugzilla.gnome.org/show_bug.cgi?id=646462
This commit is contained in:
Matthias Clasen 2011-04-01 23:52:46 -04:00
parent 315bb30220
commit b112d882ef

View File

@ -153,25 +153,29 @@ select_application_func_cb (GtkTreeModel *model,
SelectAppData *data = user_data; SelectAppData *data = user_data;
GAppInfo *app_to_match = data->info, *app = NULL; GAppInfo *app_to_match = data->info, *app = NULL;
gboolean custom; gboolean custom;
gboolean result;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
COLUMN_APP_INFO, &app, COLUMN_APP_INFO, &app,
COLUMN_CUSTOM, &custom, COLUMN_CUSTOM, &custom,
-1); -1);
/* cutsom items are always after GAppInfos, so iterating further here /* custom items are always after GAppInfos, so iterating further here
* is just useless. * is just useless.
*/ */
if (custom) if (custom)
return TRUE; result = TRUE;
else if (g_app_info_equal (app, app_to_match))
if (g_app_info_equal (app, app_to_match))
{ {
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (data->self), iter); gtk_combo_box_set_active_iter (GTK_COMBO_BOX (data->self), iter);
return TRUE; result = TRUE;
} }
else
result = FALSE;
return FALSE; g_object_unref (app);
return result;
} }
static void static void