workspacesView: Make sure to destroy non-existing workspaces

Even if they're in the end of the list. So far we've managed to not be affected
by this bug because until GNOME 3.38, workspaces didn't have a background, and
there was no way to navigate to these leftover workspaces, but with the proposed
overview changes for GNOME 40 it'll be very much visible.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1560>
This commit is contained in:
Georges Basile Stavracas Neto 2020-09-29 13:38:40 -03:00 committed by Marge Bot
parent 499af2dd81
commit 57f96b28ab

View File

@ -222,6 +222,11 @@ class WorkspacesView extends WorkspacesViewBase {
} }
} }
for (let j = this._workspaces.length - 1; j >= newNumWorkspaces; j--) {
this._workspaces[j].destroy();
this._workspaces.splice(j, 1);
}
this._updateScrollPosition(); this._updateScrollPosition();
} }