A good practice is to allocate objects derived from QObject on the heap (with operator "new"). QObjects allocated on the stack in together with a parent-child relationship tend to cause problems (*). I suggest diving into docs; QObject, Object Trees and Object Ownership..
I'm not sure if this is the problem of yours because I can't see any parent being passed for any object in the example piece of code.. But QObject parent-child relationship sure is a concept a developer must understand while developing with Qt.
(*) A QObject deletes all it's children. A child gets destructed twice in case it was allocated on the stack, 1) by the parent 2) when going out of scope => crash.
Bookmarks