[gnome-shell/gnome-3-10] ShellWindowTracker: fix reference counting of ShellApp



commit 7c199e0b1067e8d8bdf58f2e404206c426208192
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Jan 4 16:49:34 2014 +0100

    ShellWindowTracker: fix reference counting of ShellApp
    
    All get_app_from_*() helpers are transfer full, but
    get_app_from_gapplication_id() was directly returning the result
    of lookup_app(), which is transfer none.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721439

 src/shell-window-tracker.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c
index 6ec6b49..2049a09 100644
--- a/src/shell-window-tracker.c
+++ b/src/shell-window-tracker.c
@@ -256,6 +256,17 @@ get_app_from_window_wmclass (MetaWindow  *window)
   return NULL;
 }
 
+/**
+ * get_app_from_gapplication_id:
+ * @monitor: a #ShellWindowTracker
+ * @window: a #MetaWindow
+ *
+ * Looks only at the given window, and attempts to determine
+ * an application based on _GTK_APPLICATION_ID.  If one can't be determined,
+ * return %NULL.
+ *
+ * Return value: (transfer full): A newly-referenced #ShellApp, or %NULL
+ */
 static ShellApp *
 get_app_from_gapplication_id (MetaWindow  *window)
 {
@@ -268,10 +279,12 @@ get_app_from_gapplication_id (MetaWindow  *window)
 
   id = meta_window_get_gtk_application_id (window);
   if (!id)
-    return FALSE;
+    return NULL;
 
   desktop_file = g_strconcat (id, ".desktop", NULL);
   app = shell_app_system_lookup_app (appsys, desktop_file);
+  if (app)
+    g_object_ref (app);
 
   g_free (desktop_file);
   return app;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]