Skip to content

Commit 92d1e6c

Browse files
committed
WorkspaceSwitcherPopup: destroy WorkspaceThumbnail objects
WorkspaceThumbnail objects must be explicitly destroy()ed, otherwise they will not be garbage collected. Furthermore, each such object subscribes to the "window-{left,entered}-monitor" signal of the particular MetaDisplay. Thus leaking these thumbnails causes those signals to have a very large number of subscribers after the popup has been shown a sufficient number of times. This shows up in profiling, and also causes stuttering when a window is moved between monitors or created. For example, with 4*4=16 workspaces on 3 monitors, every time the popup is shown 48 new subscribers are added to both signals. After a couple days of uptime, there may be thousands. Fix that by destroying the WorkspaceThumbnail objects in `_onDestroy()`.
1 parent 5b63242 commit 92d1e6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

[email protected]/workspacePopup/workspaceSwitcherPopup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ class WorkspaceSwitcherPopup extends SwitcherPopup {
195195
while (modals.length > 0) {
196196
modals.pop().destroy();
197197
}
198+
199+
this._items.forEach((x) => x.destroy());
200+
this._items = [];
198201
}
199202

200203
vfunc_allocate(box) {

0 commit comments

Comments
 (0)