[Qt-interest] QSignalTransition drops silently signals

Peter Kümmel syntheticpp at gmx.net
Tue Jun 14 21:09:28 CEST 2011


Recently I used the QStateMachine framework in a more complex
than "animation-on-ui-event "multi-threaded environment and stumbled
over a strange behavior of QSignalTransition, which at the first glace
looks like a design error in QSignalTransition (haven't checked the
other subclassesof QAbstractTransition).

Assume following setup:

QStates:
     s1, s2, s3

QSignalTransitions
     t1: s1->s2 and t2: s2->s3
     t1 and t2 are triggered by objects of another thread than QStateMachine ones

Then this is possible:
The state machine makes the transition from s1 to s2 because t1 was triggered,
and while the state machine is busy with t1 the signal which should trigger t2
is also emitted by an object (this is possible because the emitting object runs in a other thread).
But because the connections of t2 to the signal is not created until s2 is entered,
the signal for t2 is ignored and silently dropped. No deferring, no warning, nothing,
the state machine simply will never leave t2.

Here I wonder if this is a bug or a feature?

Peter


P.S.:
Recently I also threw it into the black hole:
http://bugreports.qt.nokia.com/browse/QTBUG-19789



More information about the Qt-interest-old mailing list