]> Pileus Git - ~andy/gtk/commitdiff
GtkAppChooserButton: avoid some leaks
authorMatthias Clasen <mclasen@redhat.com>
Sat, 2 Apr 2011 03:52:46 +0000 (23:52 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 2 Apr 2011 03:53:58 +0000 (23:53 -0400)
gtk_tree_model_get() returns a reference for objects.
https://bugzilla.gnome.org/show_bug.cgi?id=646462

gtk/gtkappchooserbutton.c

index 706ce13257c38b44620c818edaadd4f711a5abfc..c50657dec1b8d915a30a333ae5b443148154817d 100644 (file)
@@ -153,25 +153,29 @@ select_application_func_cb (GtkTreeModel *model,
   SelectAppData *data = user_data;
   GAppInfo *app_to_match = data->info, *app = NULL;
   gboolean custom;
+  gboolean result;
 
   gtk_tree_model_get (model, iter,
                       COLUMN_APP_INFO, &app,
                       COLUMN_CUSTOM, &custom,
                       -1);
 
-  /* cutsom items are always after GAppInfos, so iterating further here
+  /* custom items are always after GAppInfos, so iterating further here
    * is just useless.
    */
   if (custom)
-    return TRUE;
-
-  if (g_app_info_equal (app, app_to_match))
+    result = TRUE;
+  else if (g_app_info_equal (app, app_to_match))
     {
       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