QApplication will delete the main window without caring if it is his child or not and I guess that when you delete it yourself when the application object is destructing there is no way for the MainWindow to tell to QApplication that it is deleted and eventually QApplication will try to delete it while looping trough all the objects. So you have 2 choices:

1. Make sure you delete the MainWindow before the destruction of QApplication
2. Let QApplication care for that( this can be tricky depending on your program logic ).