[gnome-shell-extensions] alternate-tab: don't crash if a window is not associated with an app



commit d1d099fbbff21eddccf8670c9cc4330d2bb47c77
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Aug 29 02:03:09 2012 +0200

    alternate-tab: don't crash if a window is not associated with an app
    
    A dialog for which the parent application is closed may end up without
    an app. In that case, show only the thumbnail, or if showing icons only,
    show a missing icon.

 extensions/alternate-tab/extension.js |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/extensions/alternate-tab/extension.js b/extensions/alternate-tab/extension.js
index 232b8c7..de4bbb2 100644
--- a/extensions/alternate-tab/extension.js
+++ b/extensions/alternate-tab/extension.js
@@ -363,17 +363,27 @@ const WindowIcon = new Lang.Class({
 					     y_expand: true });
 	    this._iconBin.add_actor(this.clone);
 
-	    this.appIcon = this.app.create_icon_texture(size / 2);
-	    this.appIcon.x_expand = this.appIcon.y_expand = true;
-	    this.appIcon.x_align = Clutter.ActorAlign.END;
-	    this.appIcon.y_align = Clutter.ActorAlign.END;
-	    this._iconBin.add_actor(this.appIcon);
+	    if (this.app) {
+		this.appIcon = this.app.create_icon_texture(size / 2);
+		this.appIcon.x_expand = this.appIcon.y_expand = true;
+		this.appIcon.x_align = Clutter.ActorAlign.END;
+		this.appIcon.y_align = Clutter.ActorAlign.END;
+		this._iconBin.add_actor(this.appIcon);
+	    }
 	    break;
 
 	case AppIconMode.APP_ICON_ONLY:
 	    size = 96;
-	    this.appIcon = this.app.create_icon_texture(size);
-	    this.appIcon.x_expand = this.appIcon.y_expand = true;
+	    if (this.app) {
+		this.appIcon = this.app.create_icon_texture(size);
+		this.appIcon.x_expand = this.appIcon.y_expand = true;
+	    } else {
+		this.appIcon = new St.Icon({ icon_name: 'icon-missing',
+					     icon_type: St.IconType.FULLCOLOR,
+					     icon_size: size,
+					     x_expand: true,
+					     y_expand: true });
+	    }
 	    this._iconBin.add_actor(this.appIcon);
 	}
 



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