BlackBerry: Increased loop level around bps_get_event

This is needed, because bps_get_event can also invoke callbacks.
Deferred deletions in such a callback are not executed for instance,
because the loop level might already be at its minimum.

Change-Id: I8a1b3a3f92de139575654de011352f8abc6c3c1a
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Jeff Kehres <jkehres@rim.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
Bernd Weimer 2013-06-25 09:53:06 +02:00 committed by The Qt Project
parent cfd207212d
commit f62c92ba84

View File

@ -43,6 +43,7 @@
#include "qsocketnotifier.h"
#include "qdebug.h"
#include "qelapsedtimer.h"
#include "private/qthread_p.h"
#include <bps/bps.h>
#include <bps/event.h>
@ -350,11 +351,16 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef
}
}
// Wait for event or file to be ready
event = 0;
const int result = bps_get_event(&event, timeoutLeft);
if (result != BPS_SUCCESS)
qWarning("QEventDispatcherBlackberry::select: bps_get_event() failed");
{ // We need to increase loop level in this scope,
// because bps_get_event can also invoke callbacks
QScopedLoopLevelCounter loopLevelCounter(d->threadData);
// Wait for event or file to be ready
const int result = bps_get_event(&event, timeoutLeft);
if (result != BPS_SUCCESS)
qWarning("QEventDispatcherBlackberry::select: bps_get_event() failed");
}
if (!event) // In case of !event, we break out of the loop to let Qt process the timers
break; // (since timeout has expired) and socket notifiers that are now ready.