Skip to content

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.

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: #6935 (closed)

Merge request reports