Because you are lucky and the order in which the compiler deletes objects that goes out of scope is exactly the one that is needed to avoid a crash. I don't want to inspect your code right now, so I'll give an easy example:
#include <QObject>
int main(int argc, char **argv){
o2.setParent(&o1);
return 0;
}
#include <QObject>
int main(int argc, char **argv){
QObject o1;
QObject o2;
o2.setParent(&o1);
return 0;
}
To copy to clipboard, switch view to plain text mode
Run this application and see if it crashes. Then switch lines 3. and 4. and run it again and again see if it crashes.
Bookmarks