diff --git a/src/blackcore/context_application_impl.h b/src/blackcore/context_application_impl.h index 9b448c89d..3beb95846 100644 --- a/src/blackcore/context_application_impl.h +++ b/src/blackcore/context_application_impl.h @@ -27,13 +27,13 @@ namespace BlackCore //! Constructor CContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime); - //! Register myself in DBus + //! Register myself in DBus, fail safe CContextApplication *registerWithDBus(CDBusServer *server) { + if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this; server->addObject(IContextApplication::ObjectPath(), this); return this; } - public: //! Destructor virtual ~CContextApplication() {} diff --git a/src/blackcore/context_audio_impl.h b/src/blackcore/context_audio_impl.h index 19f3bcedb..a4483dc15 100644 --- a/src/blackcore/context_audio_impl.h +++ b/src/blackcore/context_audio_impl.h @@ -101,7 +101,7 @@ namespace BlackCore //! \brief Register myself in DBus CContextAudio *registerWithDBus(CDBusServer *server) { - Q_ASSERT(server); + if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this; server->addObject(IContextAudio::ObjectPath(), this); return this; } diff --git a/src/blackcore/context_network_impl.h b/src/blackcore/context_network_impl.h index d72e15036..57607abfc 100644 --- a/src/blackcore/context_network_impl.h +++ b/src/blackcore/context_network_impl.h @@ -115,7 +115,7 @@ namespace BlackCore //! Register myself in DBus CContextNetwork *registerWithDBus(CDBusServer *server) { - Q_ASSERT(server); + if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this; server->addObject(IContextNetwork::ObjectPath(), this); return this; } diff --git a/src/blackcore/context_settings_impl.h b/src/blackcore/context_settings_impl.h index 530603ece..022abe4eb 100644 --- a/src/blackcore/context_settings_impl.h +++ b/src/blackcore/context_settings_impl.h @@ -33,6 +33,7 @@ namespace BlackCore //! \brief Register myself in DBus CContextSettings *registerWithDBus(CDBusServer *server) { + if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this; server->addObject(IContextSettings::ObjectPath(), this); return this; } diff --git a/src/blackcore/context_simulator_impl.h b/src/blackcore/context_simulator_impl.h index 327f3cd55..15f22e462 100644 --- a/src/blackcore/context_simulator_impl.h +++ b/src/blackcore/context_simulator_impl.h @@ -42,7 +42,7 @@ namespace BlackCore //! Register myself in DBus CContextSimulator *registerWithDBus(CDBusServer *server) { - Q_ASSERT(server); + if (!server || this->m_mode != CRuntimeConfig::LocalInDbusServer) return this; server->addObject(CContextSimulator::ObjectPath(), this); return this; }