qt5base-lts/tests/auto/corelib
Kent Hansen f9a17d7f0f statemachine: Fix signal transition handling in multi-threaded setup
By default, QStateMachine lazily registers signal transitions (i.e.,
connects to the signal) when the transition's source state is
entered. The connections are established in Qt::AutoConnection mode,
which means that if the sender object lives in a different thread,
the signal processing will be queued.

But if a sender object's signal is used in an out-going transition
of the target state of the queued transition, it's possible that a
second signal emission on the sender object's thread will be
"missed" by the state machine; before the machine gets around to
processing the first queued emission (and registering the
transitions of the new state), a sender object on the other thread
could have emitted a new signal.

The solution employed here is to eagerly register any signal
transition whose sender object is on a different thread; that is,
register it regardless of whether the transition's source state is
active.

Conversely, when a machine's transitions are unregistered (i.e.,
because the machine finished), signal transitions with sender
objects on other threads should be left as-is, in case the machine
will be run again.

This doesn't solve the case where the sender object is moved to a
different thread _after_ the transition has been initialized.
Theoretically, we could catch that by installing an event filter
on every sender object and handle the ThreadChange events, but
that would be very expensive, and likely useless in most cases.
So let's just say that that case isn't supported for now.

Task-number: QTBUG-19789
Change-Id: Ibc87bfbf2ed83217ac61ae9401fe4f179ef26c24
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-07-13 12:09:42 +02:00
..
animation Make animation autotests build without widgets 2012-06-07 00:39:05 +02:00
codecs Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
global Avoid load(testcase) for installing test helper apps 2012-07-04 02:46:27 +02:00
io Fix small problems with tst_QProcess 2012-07-12 18:34:56 +02:00
itemmodels Make it possible to use new syntax to connect to model signals. 2012-07-13 01:51:44 +02:00
json Fix some spelling errors 2012-07-11 14:52:37 +02:00
kernel Test for QMetaType binary breakage. 2012-07-13 01:51:38 +02:00
mimetypes tst_QMimeDatabase: use QFutureSynchronizer 2012-07-13 01:51:33 +02:00
plugin make use of $$[FOO/get] properties 2012-06-19 16:39:58 +02:00
statemachine statemachine: Fix signal transition handling in multi-threaded setup 2012-07-13 12:09:42 +02:00
thread Avoid load(testcase) for installing test helper apps 2012-07-04 02:46:27 +02:00
tools Write qHash functions for QDate, QTime and QDateTime. 2012-07-12 01:46:38 +02:00
xml Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
corelib.pro Import QMimeType / QMimeDatabase into QtCore. 2012-02-18 22:19:43 +01:00