qt6-bb10/src/corelib/kernel
Jonathan Hoffmann 5cc76dae7e BlackBerry: improve BPS event lifetime management
In QEventDispatcherBlackberry::select(), if an event handler called
through filterEvent() starts a nested event loop by creating a new
QEventLoop, we will recursively enter the select() method again.
However, each time bps_get_event() is called, it destroys the last
event it handed out before returning the next event.  We don't want it
to destroy the event that triggered the nested event loop, since there
may still be more handlers that need to get that event, once the
nested event loop is done and control returns to the outer event loop.

So we move an event to a holding channel, which takes ownership of the
event.  Putting the event on our own channel allows us to manage when
it is destroyed, keeping it alive until we know we are done with it.
Each recursive call of this function needs to have it's own holding
channel, since a channel is a queue, not a stack.

However, a recursive call into the select() method happens very rarely
compared to the many times this method is called.  We don't want to
create a holding channel for each time this method is called, only
when it is called recursively.  Thus we have the instance variable
d->holding_channel to use in the common case.  We keep track of
recursive calls with d->loop_level.  If we are in a recursive call,
then we create a new holding channel for this run.

Change-Id: Ib3584676d2db5a9a3754a1535d5fb6c9e14f5dbb
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
2013-10-23 19:09:54 +02:00
..
kernel.pri Android: Add private API for jni in QtCore 2013-09-20 00:59:55 +02:00
qabstracteventdispatcher.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qabstracteventdispatcher.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qabstracteventdispatcher_p.h
qabstractnativeeventfilter.cpp Mark Q_UNUSED the private members that aren't used 2013-03-23 01:55:58 +01:00
qabstractnativeeventfilter.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qbasictimer.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qbasictimer.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qcore_mac.cpp
qcore_mac_objc.mm
qcore_mac_p.h Merge remote-tracking branch 'origin/stable' into dev 2013-06-27 13:06:38 +02:00
qcore_unix.cpp Accept defeat when select(2)ing without a monotonic clock 2013-07-10 20:06:26 +02:00
qcore_unix_p.h Remove use of 'register' from Qt. 2013-06-17 09:44:22 +02:00
qcoreapplication.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qcoreapplication.h add QCoreApplication to bootstrap lib 2013-03-14 19:49:38 +01:00
qcoreapplication_mac.cpp
qcoreapplication_p.h QPA: Fix event dispatcher dependent operations in platform integration 2013-10-07 19:09:37 +02:00
qcoreapplication_win.cpp Port of Qt 4's Windows session management 2013-09-21 07:45:44 +02:00
qcorecmdlineargs_p.h WinRT: Basic global support 2013-09-20 13:53:59 +02:00
qcoreevent.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qcoreevent.h Implement native gestures on OS X. 2013-10-17 15:58:32 +02:00
qcoreglobaldata.cpp
qcoreglobaldata_p.h
qcrashhandler.cpp
qcrashhandler_p.h
qeventdispatcher_blackberry.cpp BlackBerry: improve BPS event lifetime management 2013-10-23 19:09:54 +02:00
qeventdispatcher_blackberry_p.h BlackBerry: improve BPS event lifetime management 2013-10-23 19:09:54 +02:00
qeventdispatcher_glib.cpp QThreadDataPrivate: fix data race on canWait boolean. 2013-03-22 12:12:36 +01:00
qeventdispatcher_glib_p.h
qeventdispatcher_unix.cpp Remove racy setting of eventDispatcher to 0. 2013-03-22 16:44:47 +01:00
qeventdispatcher_unix_p.h QEventDispatcherUNIX: turn interrupt bool into an atomic int. 2013-03-22 12:12:22 +01:00
qeventdispatcher_win.cpp Use correct mask constant in the Windows event dispatcher. 2013-08-20 10:22:45 +02:00
qeventdispatcher_win_p.h
qeventloop.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qeventloop.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qeventloop_p.h QEventLoop: fix race on 'exit' and 'returnCode' private members 2013-03-29 04:04:40 +01:00
qfunctions_nacl.cpp
qfunctions_nacl.h Make sure that we #include qconfig.h before testing for features. 2013-03-19 07:02:57 +01:00
qfunctions_p.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qfunctions_vxworks.cpp Use stub function rand_r for VxWorks DKM mode 2013-02-12 09:40:48 +01:00
qfunctions_vxworks.h Make sure that we #include qconfig.h before testing for features. 2013-03-19 07:02:57 +01:00
qfunctions_wince.cpp
qfunctions_wince.h QDateTime - Change date/time storage to msecs 2013-09-20 23:45:06 +02:00
qjni.cpp Android: Add private ctors in QJNIObjectPrivate that takes va_list. 2013-10-04 21:02:37 +02:00
qjni_p.h Android: Add QAndroidJniXxx as friend classes in qjni. 2013-10-09 18:22:38 +02:00
qjnihelpers.cpp Android: Use the application's class loader when loading Java classes. 2013-09-25 20:32:31 +02:00
qjnihelpers_p.h Android: Use the application's class loader when loading Java classes. 2013-09-25 20:32:31 +02:00
qjnionload.cpp Android: Added JNI_OnLoad to QtCore 2013-09-20 00:59:16 +02:00
qmath.cpp Add qDegreesToRadians and qRadiansToDegrees math functions 2013-02-05 14:40:14 +01:00
qmath.h Add qDegreesToRadians and qRadiansToDegrees math functions 2013-02-05 14:40:14 +01:00
qmath.qdoc Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qmetaobject.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qmetaobject.h Use Q_STATIC_ASSERT to report error about missing Q_OBJECT 2013-09-14 20:33:29 +02:00
qmetaobject_moc_p.h Fix minor typos in docs, printed messages & comments 2013-01-28 18:12:41 +01:00
qmetaobject_p.h
qmetaobjectbuilder.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qmetaobjectbuilder_p.h
qmetatype.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qmetatype.h MetaType: Fix operator{+,-}(int) with the type-erased const_iterators. 2013-09-13 14:37:41 +02:00
qmetatype_p.h
qmetatypeswitcher_p.h
qmimedata.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qmimedata.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qobject.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qobject.h QObject: allow connecting to functors with a receiver object 2013-09-16 23:46:30 +02:00
qobject_impl.h Use Q_STATIC_ASSERT to report error about missing Q_OBJECT 2013-09-14 20:33:29 +02:00
qobject_p.h Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qobjectcleanuphandler.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qobjectcleanuphandler.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qobjectdefs.h Use Q_STATIC_ASSERT to report error about missing Q_OBJECT 2013-09-14 20:33:29 +02:00
qobjectdefs_impl.h QObject: allow connecting to functors with a receiver object 2013-09-16 23:46:30 +02:00
qpointer.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qpointer.h Make it possible to use QPointer<const T> 2013-02-13 15:15:56 +01:00
qsharedmemory.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qsharedmemory.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qsharedmemory_android.cpp Android: Fix unused variable/argument warnings 2013-09-09 09:02:58 +02:00
qsharedmemory_p.h Introducing the Qt Android port 2013-03-05 08:31:23 +01:00
qsharedmemory_unix.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qsharedmemory_win.cpp WinRT: Shared memory support 2013-09-20 13:54:04 +02:00
qsignalmapper.cpp
qsignalmapper.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qsocketnotifier.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qsocketnotifier.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qsystemerror.cpp Implement windowsErrorString for WinRT 2013-09-16 00:14:00 +02:00
qsystemerror_p.h Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00
qsystemsemaphore.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qsystemsemaphore.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qsystemsemaphore_android.cpp Android: Fix unused variable/argument warnings 2013-09-09 09:02:58 +02:00
qsystemsemaphore_p.h
qsystemsemaphore_unix.cpp Remove use of 'register' from Qt. 2013-06-17 09:44:22 +02:00
qsystemsemaphore_win.cpp Fixed compilation of QSystemsemaphore for WinRT 2013-09-20 13:54:02 +02:00
qtcore_eval.cpp Clean up evaluation license logic 2013-07-05 09:24:39 +02:00
qtimer.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qtimer.h Make sure that we #include qconfig.h before testing for features. 2013-03-19 07:02:57 +01:00
qtimerinfo_unix.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qtimerinfo_unix_p.h Switch to struct timespec everywhere instead of timeval 2013-01-28 07:13:23 +01:00
qtranslator.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qtranslator.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00
qtranslator_p.h
qvariant.cpp Account for QPolygonF type when loading/saving the QVariant 2013-10-15 08:14:48 +02:00
qvariant.h MetaType: de-inline the container iterables. 2013-09-20 12:02:57 +02:00
qvariant_p.h Fix compilation with ICC 13.1: the MSVC 2005 & 2008 code is bad 2013-06-26 12:38:21 +02:00
qwineventnotifier.cpp Doc: Adding mark-up to boolean default values. 2013-10-08 00:46:27 +02:00
qwineventnotifier.h Remove QT_{BEGIN,END}_HEADER macro usage 2013-01-29 01:06:04 +01:00