diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 0ae04dcd5..8735a7873 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -297,17 +297,19 @@ WorkspaceThumbnail.prototype = { return; } + if (this._allWindows.indexOf(metaWin) == -1) { + let minimizedChangedId = metaWin.connect('notify::minimized', + Lang.bind(this, + this._updateMinimized)); + this._allWindows.push(metaWin); + this._minimizedChangedIds.push(minimizedChangedId); + } + // We might have the window in our list already if it was on all workspaces and // now was moved to this workspace - if (this._allWindows.indexOf(metaWin) != -1) + if (this._lookupIndex (metaWin) != -1) return; - let minimizedChangedId = metaWin.connect('notify::minimized', - Lang.bind(this, - this._updateMinimized)); - this._allWindows.push(metaWin); - this._minimizedChangedIds.push(minimizedChangedId); - if (!this._isMyWindow(win) || !this._isOverviewWindow(win)) return; @@ -601,10 +603,10 @@ ThumbnailsBox.prototype = { if (thumbnail.state > ThumbnailState.NORMAL) continue; - thumbnail.workspaceRemoved(); - - if (currentPos >= start && currentPos < start + count) + if (currentPos >= start && currentPos < start + count) { + thumbnail.workspaceRemoved(); this._setThumbnailState(thumbnail, ThumbnailState.REMOVING); + } currentPos++; }