From 8da632a54ca74a3d95de55ad7263f31b2c9619b5 Mon Sep 17 00:00:00 2001 From: MrBeanDev Date: Mon, 3 Aug 2026 12:01:07 +0530 Subject: [PATCH] grouped-window-list: guard against null close button on UI scale change WindowThumbnail registers a thumbnailCloseButtonOffset listener in its constructor, but this.button is not created until later in setup and is gone once the thumbnail has been destroyed. onUIScaleChange() dispatches the new offset to every registered thumbnail, so any that are still being constructed or already torn down raise "TypeError: this.button is null". This is reachable on any monitor hotplug that changes the global UI scale (lid close/open, unplugging an external display) when monitors are running at different fractional scales. The exception leaves the applet's actor tree inconsistent, which can end with Cinnamon spinning on its main thread. Skip the style update when there is no button to style. --- .../cinnamon/applets/grouped-window-list@cinnamon.org/menus.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/menus.js b/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/menus.js index 607b9cbd32..490ad6c77e 100644 --- a/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/menus.js +++ b/files/usr/share/cinnamon/applets/grouped-window-list@cinnamon.org/menus.js @@ -462,6 +462,9 @@ class WindowThumbnail { this.destroyOverlayPreview(); }, thumbnailCloseButtonOffset: ({thumbnailCloseButtonOffset}) => { + // This fires for every registered thumbnail, including ones whose + // button has not been created yet or has already been destroyed. + if (!this.button) return; this.button.style = CLOSED_BUTTON_STYLE + `position: ${thumbnailCloseButtonOffset}px -2px;`; } });