workspacesView: Skip relayouts during destruction
The WorkspacesView may be scheduled to be destroyed during relayout, and despite that go through the allocate() vfunc. When that happens, the ::destroy handler is called early, so the WorkspacesView clears this._workspaces in result. When vfunc_allocate() is called, various paths rely on the workspaces array being still populated, which is not the case. The existing check at vfunc_allocate() for the WorkspacesView having no children is insufficient, since children are destroyed as a result, not beforehand. This results in the following warnings when going out of overview: JS ERROR: TypeError: workspace is undefined _getSpacing@resource:///org/gnome/shell/ui/workspacesView.js:218:13 vfunc_allocate@resource:///org/gnome/shell/ui/workspacesView.js:344:18 vfunc_allocate@resource:///org/gnome/shell/ui/overviewControls.js:223:33 removeWindow@resource:///org/gnome/shell/ui/workspace.js:856:29 addWindow/<.destroyId<@resource:///org/gnome/shell/ui/workspace.js:808:22 _updateWorkspacesViews@resource:///org/gnome/shell/ui/workspacesView.js:1023:38 prepareToEnterOverview@resource:///org/gnome/shell/ui/workspacesView.js:990:14 prepareToEnterOverview@resource:///org/gnome/shell/ui/overviewControls.js:740:33 gestureBegin@resource:///org/gnome/shell/ui/overviewControls.js:802:14 _gestureBegin@resource:///org/gnome/shell/ui/overview.js:409:33 _beginGesture@resource:///org/gnome/shell/ui/swipeTracker.js:601:14 _handleEvent@resource:///org/gnome/shell/ui/swipeTracker.js:173:26 @resource:///org/gnome/shell/ui/init.js:21:20 This always happens through the _updateWorkspacesViews() paths, so there is a new WorkspacesView taking over and the one being destroyed should silently go away. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6935 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2918>
This commit is contained in:
parent
1f7464dbcb
commit
7095ef05e1
@ -331,7 +331,7 @@ class WorkspacesView extends WorkspacesViewBase {
|
||||
vfunc_allocate(box) {
|
||||
this.set_allocation(box);
|
||||
|
||||
if (this.get_n_children() === 0)
|
||||
if (this._workspaces.length === 0)
|
||||
return;
|
||||
|
||||
const vertical = global.workspaceManager.layout_rows === -1;
|
||||
|
Loading…
Reference in New Issue
Block a user