diff --git a/src/modules/sni/host.cpp b/src/modules/sni/host.cpp index fff8e019..0bbd4d2f 100644 --- a/src/modules/sni/host.cpp +++ b/src/modules/sni/host.cpp @@ -19,9 +19,13 @@ Host::Host(const std::size_t id, const Json::Value& config, const Bar& bar, Host::~Host() { if (bus_name_id_ > 0) { - Gio::DBus::unwatch_name(bus_name_id_); + Gio::DBus::unown_name(bus_name_id_); bus_name_id_ = 0; } + if (watcher_id_ > 0) { + Gio::DBus::unwatch_name(watcher_id_); + watcher_id_ = 0; + } g_cancellable_cancel(cancellable_); g_clear_object(&cancellable_); g_clear_object(&watcher_); diff --git a/src/modules/sni/watcher.cpp b/src/modules/sni/watcher.cpp index 663fdcdc..dfd076ef 100644 --- a/src/modules/sni/watcher.cpp +++ b/src/modules/sni/watcher.cpp @@ -14,6 +14,10 @@ Watcher::Watcher() watcher_(sn_watcher_skeleton_new()) {} Watcher::~Watcher() { + if (hosts_ != nullptr) { + g_slist_free_full(hosts_, gfWatchFree); + hosts_ = nullptr; + } if (items_ != nullptr) { g_slist_free_full(items_, gfWatchFree); items_ = nullptr;