&DBusConnection::onLibdbusObjectPathMessageThunk
};
-void DBusConnection::dispatch(std::shared_ptr<DBusConnection> selfReference) {
- while (!stopDispatching_ && readWriteDispatch(10) && !selfReference.unique()) {
+void DBusConnection::dispatch(std::shared_ptr<DBusConnection>* selfReference) {
+//void DBusConnection::dispatch() {
+ //auto selfReference = this->shared_from_this();
+ while (!stopDispatching_ && readWriteDispatch(10) && !selfReference->unique()) {
if(pauseDispatching_) {
dispatchSuspendLock_.lock();
dispatchSuspendLock_.unlock();
}
}
+ delete selfReference;
+
}
bool DBusConnection::readWriteDispatch(int timeoutMilliseconds) {
initLibdbusSignalFilterAfterConnect();
if(startDispatchThread) {
- dispatchThread_ = new std::thread(&DBusConnection::dispatch, this, this->shared_from_this());
+ std::shared_ptr<DBusConnection>* ptr = new std::shared_ptr<DBusConnection>(this->shared_from_this());
+ dispatchThread_ = new std::thread(&DBusConnection::dispatch, this, ptr);
}
stopDispatching_ = !startDispatchThread;
bool singleDispatch();
private:
- void dispatch(std::shared_ptr<DBusConnection> selfReference);
+ void dispatch(std::shared_ptr<DBusConnection>* selfReference);
void suspendDispatching() const;
void resumeDispatching() const;