fix(mpris): defer widget visibility to update() to stop resume SIGSEGV
The name-vanished playerctl callback called event_box_.set_visible(false) directly. On resume from suspend this runs in a re-entrant / torn-down state and crashes in Gtk::Widget::set_visible. Only clear the player and dp.emit() from the callback; update() (on the main thread) computes visibility from player state and hides the module when there is no player, matching the other hardened handlers. Fixes #5124.
This commit is contained in:
@@ -406,8 +406,11 @@ auto Mpris::onPlayerNameVanished(PlayerctlPlayerManager* manager, PlayerctlPlaye
|
||||
if (mpris->player_ == "playerctld") {
|
||||
mpris->dp.emit();
|
||||
} else if (mpris->player_ == player_name->name) {
|
||||
// Don't touch GTK widgets directly from the playerctl callback: on resume
|
||||
// from suspend this can run in a re-entrant / torn-down state and crash in
|
||||
// Gtk::Widget::set_visible. Only update state + emit; update() (on the main
|
||||
// thread) hides the module when there is no player. See #5124.
|
||||
mpris->player = nullptr;
|
||||
mpris->event_box_.set_visible(false);
|
||||
mpris->dp.emit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user