fix(bar): avoid use-after-free segfault on exit

Members are destroyed in reverse declaration order, so modules_all_ (and
the modules it owns) are gone before the GtkWindow. Tearing down a mapped
window emits `unmap`, whose handler runs toggleSuspend() over the already
freed modules. Disconnect the map/unmap handlers in ~Bar first.

Fixes #5182
This commit is contained in:
Alex
2026-07-05 22:03:28 +02:00
parent 9d8a8356b5
commit 445e2aec1f
2 changed files with 12 additions and 3 deletions
+4
View File
@@ -131,6 +131,10 @@ class Bar : public sigc::trackable {
waybar::util::KillSignalAction onSigusr1 = util::SIGNALACTION_DEFAULT_SIGUSR1;
waybar::util::KillSignalAction onSigusr2 = util::SIGNALACTION_DEFAULT_SIGUSR2;
/* Disconnected in ~Bar before the modules are destroyed (#5182). */
sigc::connection map_conn_;
sigc::connection unmap_conn_;
};
} // namespace waybar