diff --git a/src/lib/dbus/Glue.cxx b/src/lib/dbus/Glue.cxx index 07e264e27..3638e3c51 100644 --- a/src/lib/dbus/Glue.cxx +++ b/src/lib/dbus/Glue.cxx @@ -19,9 +19,22 @@ #include "config.h" #include "Glue.hxx" +#include "event/Call.hxx" namespace ODBus { +void +Glue::ConnectIndirect() +{ + BlockingCall(GetEventLoop(), [this](){ Connect(); }); +} + +void +Glue::DisconnectIndirect() +{ + BlockingCall(GetEventLoop(), [this](){ Disconnect(); }); +} + void Glue::Connect() { diff --git a/src/lib/dbus/Glue.hxx b/src/lib/dbus/Glue.hxx index 49f35b170..ed6612155 100644 --- a/src/lib/dbus/Glue.hxx +++ b/src/lib/dbus/Glue.hxx @@ -35,11 +35,11 @@ class Glue final : ODBus::WatchManagerObserver { public: explicit Glue(EventLoop &event_loop) :watch(event_loop, *this) { - Connect(); + ConnectIndirect(); } ~Glue() noexcept { - Disconnect(); + DisconnectIndirect(); } EventLoop &GetEventLoop() noexcept { @@ -51,6 +51,9 @@ public: } private: + void ConnectIndirect(); + void DisconnectIndirect(); + void Connect(); void Disconnect();