Skip to content

Stop dbus mainloop before destroying tray on exit - #2328

Closed
vynride wants to merge 1 commit into
Taiko2k:masterfrom
vynride:fix-tray-exit-segfault
Closed

Stop dbus mainloop before destroying tray on exit#2328
vynride wants to merge 1 commit into
Taiko2k:masterfrom
vynride:fix-tray-exit-segfault

Conversation

@vynride

@vynride vynride commented Sep 9, 2026

Copy link
Copy Markdown

Fixes #2327

The dbus/MPRIS thread runs a GLib.MainLoop that services the SDL tray's libdbusmenu events. It was a daemon thread that was never stopped, so on exit SDL_Quit freed the tray objects while that thread could still be dispatching callbacks on them, causing an intermittent segfault.

This change:

  • keeps the GLib.MainLoop as an attribute on Gnome so it can be stopped
  • keeps a reference to the dbus thread on Tauon
  • on exit, quits the loop via GLib.idle_add, joins the thread with a 2s timeout (logging a warning if it does not stop), destroys the tray explicitly, and only then calls SDL_Quit

@C0rn3j

C0rn3j commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Next time, please mark what is your own words and what is AI, same goes for the code.

I'll post up an explanation on your issue in a bit as to why I closed this.

EDIT: Removed the harsh wording

@C0rn3j C0rn3j closed this Sep 9, 2026
@vynride

vynride commented Sep 9, 2026

Copy link
Copy Markdown
Author

Hey @C0rn3j, sorry about that. I just wanted to solve the error since I kept getting it randomly when I closed Tauon.

I'll keep your review in mind, sorry again.

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.

Segfault on exit when system tray is enabled (libdbusmenu use-after-free)

2 participants