Skip to content

Commit

Permalink
Merge pull request #16 from mer-packages/guardpendingcall
Browse files Browse the repository at this point in the history
[libsignon-qt] Guard PendingCall against deletion by connected slots
  • Loading branch information
Chris Adams committed Feb 6, 2015
2 parents 728c2cb + dd26089 commit 0d83f6e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libsignon/lib/SignOn/async-dbus-proxy.cpp
Expand Up @@ -30,6 +30,7 @@
#include <QDebug>
#include <QMetaMethod>
#include <QMetaType>
#include <QPointer>

#include "connection-manager.h"
#include "dbusinterface.h"
Expand Down Expand Up @@ -117,12 +118,16 @@ void PendingCall::onFinished(QDBusPendingCallWatcher *watcher)
}
}

QPointer<PendingCall> thisguard(this);
QPointer<QDBusPendingCallWatcher> watcherguard(watcher);
if (watcher->isError()) {
Q_EMIT error(watcher->error());
} else {
Q_EMIT success(watcher);
}
Q_EMIT finished(watcher);
if (thisguard) {
Q_EMIT finished(watcherguard ? watcher : 0);
}
}

void PendingCall::onInterfaceDestroyed()
Expand Down

0 comments on commit 0d83f6e

Please sign in to comment.