Qt World Summit: Submit your Presentation

Transition sometimes not firing in multithread situation

  • Hi,
    I have the following scheme:

    • a transition between two states fired by a signal "stopped()" emitted by an object,
    • the object is regularly deleted ands replaced by a new instance. The associated transition is created again each time the object is replaced (I have checked this). The previous transition is deleted before the creation of the new transition. I have used "delete" hoping it will remove the transition. I cannot use removeTransition() because the deletion/creation of the transition is not performed at the same time of the deletion/creation of the object,
    • the object is created in the main thread,
    • the member function emitting the signal is called from another thread (i.e. not the main thread). But the object is not moved in this thread.

    Then, sometimes, the transition is not executed. I have found no specific situation creating this. I am sure that the signal is emitted, and processed by the event loop. Because I have connected a functor on the signal to display some traces. These traces prove that the initial state is active (present in the state machine configuration).

Log in to reply