Fix crashes on shutdown when the D-Bus spy list has been destroyed

The QDBusConnection spy hook is most often created after the
QDBusConnectionManager global, which means it will get destroyed before.
That means we'll almost surely going to get a null pointer dereference
if we handle the socket close to shutdown.

Change-Id: I27eaacb532114dd188c4ffff13d4c9dc865b8c02
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
bb10
Thiago Macieira 2015-04-13 22:22:10 -07:00
parent 91dfab223a
commit 2bcbe227bd
1 changed files with 1 additions and 1 deletions

View File

@ -554,7 +554,7 @@ qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
{
const QDBusSpyHookList *list = qDBusSpyHookList();
for (int i = 0; i < list->size(); ++i) {
for (int i = 0; list && i < list->size(); ++i) {
qDBusDebug() << "calling the message spy hook";
(*(*list)[i])(amsg);
}