diff options
| -rw-r--r-- | launcher/LauncherController.cpp | 19 | ||||
| -rw-r--r-- | launcher/LauncherControllerPrivate.h | 4 |
2 files changed, 16 insertions, 7 deletions
diff --git a/launcher/LauncherController.cpp b/launcher/LauncherController.cpp index 13999ec6f..5d2fe3bc5 100644 --- a/launcher/LauncherController.cpp +++ b/launcher/LauncherController.cpp @@ -112,6 +112,8 @@ Controller::Impl::Impl(Controller* parent) , launcher_key_press_time_(0) , dbus_owner_(g_bus_own_name(G_BUS_TYPE_SESSION, DBUS_NAME.c_str(), G_BUS_NAME_OWNER_FLAGS_NONE, OnBusAcquired, nullptr, nullptr, this, nullptr)) + , gdbus_connection_(nullptr) + , reg_id_(0) { edge_barriers_.options = parent_->options(); @@ -164,6 +166,9 @@ Controller::Impl::~Impl() launcher_ptr->GetParent()->UnReference(); } + if (gdbus_connection_ && reg_id_) + g_dbus_connection_unregister_object(gdbus_connection_, reg_id_); + g_bus_unown_name(dbus_owner_); } @@ -1409,7 +1414,6 @@ void Controller::Impl::ReceiveLauncherKeyPress(unsigned long eventType, void Controller::Impl::OnBusAcquired(GDBusConnection* connection, const gchar* name, gpointer user_data) { GDBusNodeInfo* introspection_data = g_dbus_node_info_new_for_xml(DBUS_INTROSPECTION.c_str(), nullptr); - unsigned int reg_id; if (!introspection_data) { @@ -1417,11 +1421,14 @@ void Controller::Impl::OnBusAcquired(GDBusConnection* connection, const gchar* n return; } - reg_id = g_dbus_connection_register_object(connection, DBUS_PATH.c_str(), - introspection_data->interfaces[0], - &interface_vtable, user_data, - nullptr, nullptr); - if (!reg_id) + auto self = static_cast<Controller::Impl*>(user_data); + + self->gdbus_connection_ = connection; + self->reg_id_ = g_dbus_connection_register_object(connection, DBUS_PATH.c_str(), + introspection_data->interfaces[0], + &interface_vtable, user_data, + nullptr, nullptr); + if (!self->reg_id_) { LOG_WARNING(logger) << "Object registration failed. Won't get dynamic launcher addition."; } diff --git a/launcher/LauncherControllerPrivate.h b/launcher/LauncherControllerPrivate.h index 708c7415f..181d7a2f0 100644 --- a/launcher/LauncherControllerPrivate.h +++ b/launcher/LauncherControllerPrivate.h @@ -135,8 +135,10 @@ public: int reactivate_index; bool keynav_restore_window_; int launcher_key_press_time_; - unsigned dbus_owner_; + unsigned dbus_owner_; + GDBusConnection* gdbus_connection_; + unsigned reg_id_; glib::Signal<void, BamfMatcher*, BamfView*> view_opened_signal_; glib::SourceManager sources_; |
