Skip to content

Commit

Permalink
[libsignon-qt] Guard PendingCall against deletion by connected slots
Browse files Browse the repository at this point in the history
This commit uses QPointer to guard the PendingCall object (and the
QDBusPendingCallWatcher associated with it).

It should not be required, and this commit should be removed once
the root cause (connected slot which delete's the PendingCall via
side-effect) is found and corrected.
  • Loading branch information
Chris Adams committed Feb 6, 2015
1 parent 728c2cb commit dd26089
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 dd26089

Please sign in to comment.