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.
This commit is contained in:
Giovanni Campagna
2012-08-29 02:03:09 +02:00
parent 45da997dd3
commit d1d099fbbf

View File

@@ -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);
}