The privacy module registers timeout callbacks in the GLib main context.
The GeoClue callback uses sigc::mem_fun() with the Privacy object, but the
connection remains active when the module is destroyed during a bar reload.
If the timeout runs after destruction, it dereferences the freed Privacy
object and crashes Waybar:
#0 waybar::modules::privacy::Privacy::locationTimeout(bool)
#4 g_main_context_iteration()
#5 g_application_run()
Disconnect the GeoClue and visibility timeout connections in the Privacy
destructor so no callback can run after the module is gone.
The unpatched binary crashed after four SIGUSR2 reloads at 1.5-second
intervals. The patched binary survived ten reloads.
Fixes: eeb7bc702e ("Added GeoClue2 privacy item")
Assisted-by: Claude Opus + Cursor
Rebased onto current master and fixed the privacy module build:
- privacy_item.hpp no longer includes privacy.hpp (it does not use the
Privacy class); this broke the circular include that left PrivacyItem
undeclared when privacy.hpp was reached first from privacy_item.cpp.
- privacy_item.cpp now includes gtkmm/label.h explicitly, since Gtk::Label
was previously only pulled in transitively via privacy.hpp.