[Qt-interest] It works...not sure how (QT state machine object ownership) :)
Stephen Jackson
spjackson42 at gmail.com
Sat May 29 15:07:44 CEST 2010
On 29 May 2010 10:05, Mandeep Sandhu wrote:
>
> My confusion arises from the fact that neither the custom states nor
> the transitions are children of my app class (in the QObject
> heirarchy) but still the object cleanup happens properly on exit.
>
Your states are children of the state machine. Your transitions are
children of your states. What makes you think that this is not the
case?
> Since my app's destructor will be calling QStateMachine's destructor,
> I'm guessing the QSM will be further doing the state/transtion
> cleanup. Is it so?
>
Yes. The documentation on QStateMachine::addState,
QStateMachine::removeState, QState::addTransition,
QState::removeTransition are clear enough about ownership: adding an
object transfers ownership of that object.
If you are still in doubt, despite the documentation, you could set a
debugger breakpoint in your state/transition destructor and look at
the call stack to see where they are being called.
--
HTH,
Stephen Jackson
More information about the Qt-interest-old
mailing list