[gnome-shell] ShellApp: Avoid crashing during state transition for window-backed apps



commit fa0268f35a720552b6c00315e7f35ece358e2232
Author: Colin Walters <walters verbum org>
Date:   Tue Aug 23 12:03:56 2011 -0400

    ShellApp: Avoid crashing during state transition for window-backed apps
    
    During a state transition from running to not-running for
    window-backend apps, it's possible we get a request for the icon.
    Avoid asserting here and just return an empty image.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656546

 src/shell-app.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index a0bddea..75444b6 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -133,8 +133,22 @@ static ClutterActor *
 window_backed_app_get_icon (ShellApp *app,
                             int       size)
 {
-  MetaWindow *window = window_backed_app_get_window (app);
-  ClutterActor *actor = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
+  MetaWindow *window;
+  ClutterActor *actor;
+
+  /* During a state transition from running to not-running for
+   * window-backend apps, it's possible we get a request for the icon.
+   * Avoid asserting here and just return an empty image.
+   */
+  if (app->running_state == NULL)
+    {
+      actor = clutter_texture_new ();
+      g_object_set (actor, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
+      return actor;
+    }
+
+  window = window_backed_app_get_window (app);
+  actor = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
                                                                G_OBJECT (window),
                                                                "icon");
   g_object_set (actor, "width", (float) size, "height", (float) size, NULL);



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