grouped-window-list: guard against null close button in thumbnailCloseButtonOffset handler - #13917
Open
mrbeandev wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WindowThumbnail's constructor registers athumbnailCloseButtonOffsetstate listener atmenus.js:464, butthis.buttonis not assigned untilmenus.js:529, and it is gone again once the thumbnail is destroyed. The listener dereferences it unconditionally:GroupedWindowListApplet.onUIScaleChange()callsstate.set({thumbnailCloseButtonOffset: ...}), which dispatches to every registeredWindowThumbnail— including any that are still mid-construction or already torn down. Those throw:How I hit it
Laptop panel plus an external monitor at different fractional scales (1.25 and 1.0), with
scale-monitor-framebufferandx11-randr-fractional-scalingenabled. Closing and reopening the lid re-detects the outputs, which changes the global UI scale and firesonUIScaleChangewhile thumbnails are being rebuilt.The exception left the applet's actor tree inconsistent. Orphaned actors then accumulated:
About 80 minutes later Cinnamon's main thread went to 100% CPU and stopped responding entirely — the session froze with only the mouse cursor still moving, since that is drawn on the hardware cursor plane. Xorg itself stayed at 0% CPU and healthy throughout, and
cinnamon-killer-daemoneventually dropped the session to the metacity/mate-panel fallback.Any monitor hotplug that changes the global scale should reach this — unplugging an external display or a monitor going to sleep, not just the lid.
Fix
Return early when there is no button to style. Same approach as #13633.
Environment
Cinnamon 6.6.4, muffin 6.6.1, Linux Mint 22.3, X11, two monitors at scales 1.25 / 1.0.