Skip to content

sound@cinnamon.org: Don't add duplicate Open/Quit Player buttons - #14060

Open
somedev7 wants to merge 1 commit into
linuxmint:masterfrom
somedev7:sound-player-buttons
Open

somedev7 wants to merge 1 commit into
linuxmint:masterfrom
somedev7:sound-player-buttons

Conversation

@somedev7

Copy link
Copy Markdown

Problem

Player adds a new "Open Player" / "Quit Player" ControlButton every time a PropertiesChanged signal contains CanRaise / CanQuit. Firefox's MPRIS player sends these repeatedly, so the buttons pile up in _playerBox, and their tooltips pile up in Main.uiGroup. Also, props.CanRaise is a GVariant, so if (props.CanRaise) is true even when the value is false.

Impact

Found while investigating periodic desktop stutter on Linux Mint 22.3 / Cinnamon 6.6.9 / cjs 115.1. After 33 days of uptime the live JS heap (imports.system.dumpMemoryInfo() → gcBytes) was 329 MB. Since cjs schedules a non-incremental "big hammer" GC on toggle-down, which on a live desktop fires every ~10 s, the compositor was blocked 200–234 ms every 10 s (a forced imports.system.gc() took 215 ms). After restarting Cinnamon: 6 MB heap, 7 ms GC. A heap dump showed several leaks; the biggest one is #13956 (fix in #13958), this is another one.

After 33 days the Firefox player's _playerBox had 510 children (about 254 "Open Player" + 254 "Quit Player" buttons), and Main.uiGroup held 509 matching tooltip actors.

Fix

  • Keep references to the two buttons and create each one only once.
  • Check the unpacked value of CanRaise / CanQuit from PropertiesChanged.

The create-once guard was verified on 6.6.9 with an equivalent runtime patch: repeated _showCanRaise() / _showCanQuit() calls no longer add buttons. The unpack() change is not exercised by that test.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant