workspace: Don't keep stale clones in list
If a clone gets destroyed before the corresponding MetaWindow is removed from the workspace, we will still find it in the list of clones and try to destroy it again. Avoid the resulting warnings by updating the list of clones immediately when a clone is destroyed. https://bugzilla.gnome.org/show_bug.cgi?id=791233
This commit is contained in:
parent
02c5b4b947
commit
f26cc3ac23
@ -1431,34 +1431,26 @@ var Workspace = new Lang.Class({
|
|||||||
_doRemoveWindow(metaWin) {
|
_doRemoveWindow(metaWin) {
|
||||||
let win = metaWin.get_compositor_private();
|
let win = metaWin.get_compositor_private();
|
||||||
|
|
||||||
// find the position of the window in our list
|
let clone = this._removeWindowClone(metaWin);
|
||||||
let index = this._lookupIndex (metaWin);
|
|
||||||
|
|
||||||
if (index == -1)
|
if (clone) {
|
||||||
return;
|
// If metaWin.get_compositor_private() returned non-NULL, that
|
||||||
|
// means the window still exists (and is just being moved to
|
||||||
let clone = this._windows[index];
|
// another workspace or something), so set its overviewHint
|
||||||
|
// accordingly. (If it returned NULL, then the window is being
|
||||||
this._windows.splice(index, 1);
|
// destroyed; we'd like to animate this, but it's too late at
|
||||||
this._windowOverlays.splice(index, 1);
|
// this point.)
|
||||||
|
if (win) {
|
||||||
// If metaWin.get_compositor_private() returned non-NULL, that
|
let [stageX, stageY] = clone.actor.get_transformed_position();
|
||||||
// means the window still exists (and is just being moved to
|
let [stageWidth, stageHeight] = clone.actor.get_transformed_size();
|
||||||
// another workspace or something), so set its overviewHint
|
win._overviewHint = {
|
||||||
// accordingly. (If it returned NULL, then the window is being
|
x: stageX,
|
||||||
// destroyed; we'd like to animate this, but it's too late at
|
y: stageY,
|
||||||
// this point.)
|
scale: stageWidth / clone.actor.width
|
||||||
if (win) {
|
};
|
||||||
let [stageX, stageY] = clone.actor.get_transformed_position();
|
}
|
||||||
let [stageWidth, stageHeight] = clone.actor.get_transformed_size();
|
clone.destroy();
|
||||||
win._overviewHint = {
|
|
||||||
x: stageX,
|
|
||||||
y: stageY,
|
|
||||||
scale: stageWidth / clone.actor.width
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
clone.destroy();
|
|
||||||
|
|
||||||
|
|
||||||
// We need to reposition the windows; to avoid shuffling windows
|
// We need to reposition the windows; to avoid shuffling windows
|
||||||
// around while the user is interacting with the workspace, we delay
|
// around while the user is interacting with the workspace, we delay
|
||||||
@ -1848,6 +1840,9 @@ var Workspace = new Lang.Class({
|
|||||||
clone.connect('size-changed', () => {
|
clone.connect('size-changed', () => {
|
||||||
this._recalculateWindowPositions(WindowPositionFlags.NONE);
|
this._recalculateWindowPositions(WindowPositionFlags.NONE);
|
||||||
});
|
});
|
||||||
|
clone.actor.connect('destroy', () => {
|
||||||
|
this._removeWindowClone(clone.metaWindow);
|
||||||
|
});
|
||||||
|
|
||||||
this.actor.add_actor(clone.actor);
|
this.actor.add_actor(clone.actor);
|
||||||
|
|
||||||
@ -1869,6 +1864,17 @@ var Workspace = new Lang.Class({
|
|||||||
return [clone, overlay];
|
return [clone, overlay];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_removeWindowClone(metaWin) {
|
||||||
|
// find the position of the window in our list
|
||||||
|
let index = this._lookupIndex (metaWin);
|
||||||
|
|
||||||
|
if (index == -1)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
this._windowOverlays.splice(index, 1);
|
||||||
|
return this._windows.splice(index, 1).pop();
|
||||||
|
},
|
||||||
|
|
||||||
_onShowOverlayClose(windowOverlay) {
|
_onShowOverlayClose(windowOverlay) {
|
||||||
for (let i = 0; i < this._windowOverlays.length; i++) {
|
for (let i = 0; i < this._windowOverlays.length; i++) {
|
||||||
let overlay = this._windowOverlays[i];
|
let overlay = this._windowOverlays[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user