diff options
author | Bernd Weimer <bweimer@blackberry.com> | 2013-07-02 08:21:51 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-02 15:12:34 (GMT) |
commit | efcbcd3e23b530443b55374e63db39e27b21ad9c (patch) | |
tree | 11f654042c68fbf125c1d8a4b2551541a3313a01 /src/corelib/kernel | |
parent | e3c44790065894f4e7f98ab097fce22c5bcbbd0a (diff) | |
download | Qt-efcbcd3e23b530443b55374e63db39e27b21ad9c.zip Qt-efcbcd3e23b530443b55374e63db39e27b21ad9c.tar.gz Qt-efcbcd3e23b530443b55374e63db39e27b21ad9c.tar.bz2 |
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.
Backported from qtbase: f62c92b
Change-Id: I83d72d773d53b7b84ec590180f6b1131a57e0f46
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_blackberry.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp index f29a0b7..ea6ed93 100644 --- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp +++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp @@ -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> @@ -351,11 +352,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 (Q_UNLIKELY(result != BPS_SUCCESS)) - qWarning("QEventDispatcherBlackberry 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 (Q_UNLIKELY(result != BPS_SUCCESS)) + qWarning("QEventDispatcherBlackberry: 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. |