From 8943b3b0e917ab2e38039c1f411146d475415ee7 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 11 Jan 2012 17:24:42 -0500 Subject: [PATCH] workspaceThumbnail: disconnect handlers when workspace is removed We need to remove the handlers when the workspace is removed, not when the animation of it being removed finishes, or we can access a destroyed workspace and triggger an assertion failure in Mutter. https://bugzilla.redhat.com/show_bug.cgi?id=705664 https://bugzilla.gnome.org/show_bug.cgi?id=667652 --- js/ui/workspaceThumbnail.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index b48289935..da252983b 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -154,6 +154,8 @@ const WorkspaceThumbnail = new Lang.Class({ this.metaWorkspace = metaWorkspace; this.monitorIndex = Main.layoutManager.primaryIndex; + this._removed = false; + this.actor = new St.Group({ reactive: true, clip_to_allocation: true, style_class: 'workspace-thumbnail' }); @@ -284,7 +286,7 @@ const WorkspaceThumbnail = new Lang.Class({ }, _doAddWindow : function(metaWin) { - if (this.leavingOverview) + if (this._removed) return; let win = metaWin.get_compositor_private(); @@ -294,7 +296,7 @@ const WorkspaceThumbnail = new Lang.Class({ // the compositor finds out about them... Mainloop.idle_add(Lang.bind(this, function () { - if (this.actor && + if (!this._removed && metaWin.get_compositor_private() && metaWin.get_workspace() == this.metaWorkspace) this._doAddWindow(metaWin); @@ -350,7 +352,12 @@ const WorkspaceThumbnail = new Lang.Class({ this.actor.destroy(); }, - _onDestroy: function(actor) { + workspaceRemoved : function() { + if (this._removed) + return; + + this._removed = true; + this.metaWorkspace.disconnect(this._windowAddedId); this.metaWorkspace.disconnect(this._windowRemovedId); global.screen.disconnect(this._windowEnteredMonitorId); @@ -363,6 +370,10 @@ const WorkspaceThumbnail = new Lang.Class({ delete metaWin._minimizedChangedId; } } + }, + + _onDestroy: function(actor) { + this.workspaceRemoved(); this._windows = []; this.actor = null; @@ -732,6 +743,8 @@ const ThumbnailsBox = new Lang.Class({ if (thumbnail.state > ThumbnailState.NORMAL) continue; + thumbnail.workspaceRemoved(); + if (currentPos >= start && currentPos < start + count) this._setThumbnailState(thumbnail, ThumbnailState.REMOVING);