Merge pull request #5249 from shivankgarg98/fix/privacy-timeout-use-after-free

privacy: disconnect pending timeouts on destruction
This commit is contained in:
Alexis Rouillard
2026-08-13 09:35:07 +02:00
committed by GitHub
2 changed files with 10 additions and 0 deletions
+1
View File
@@ -17,6 +17,7 @@ namespace waybar::modules::privacy {
class Privacy : public AModule { class Privacy : public AModule {
public: public:
Privacy(const std::string&, const Json::Value&, Gtk::Orientation, const std::string& pos); Privacy(const std::string&, const Json::Value&, Gtk::Orientation, const std::string& pos);
~Privacy() override;
auto update() -> void override; auto update() -> void override;
private: private:
+9
View File
@@ -119,6 +119,15 @@ Privacy::Privacy(const std::string& id, const Json::Value& config, Gtk::Orientat
sigc::mem_fun(*this, &Privacy::onGeoCluePrivacyNodesChanged)); sigc::mem_fun(*this, &Privacy::onGeoCluePrivacyNodesChanged));
} }
Privacy::~Privacy() {
// Both timeouts are attached to the global main context, which outlives this
// module when the bar is reloaded. sigc::connection's destructor does not
// disconnect, and the members are torn down after the backends they use, so a
// pending timeout would dispatch onto freed memory.
geoclue_timeout_conn.disconnect();
visibility_conn.disconnect();
}
void Privacy::onPWPrivacyNodesChanged() { void Privacy::onPWPrivacyNodesChanged() {
mutex_.lock(); mutex_.lock();
nodes_audio_out.clear(); nodes_audio_out.clear();