I have an open QDialog and create a popup menu and show it with QMenu::exec().
On a Mac it is possible to close the dialog while the menu is open. The menu is closed and destroyed automatically since it is a child of the dialog. However, QMenu::exec() returns after dialog and menu have been destroyed, and the line "delete menu" in the above code creates a crash. Unter Windows this situation never appears because clicking on the dialog's close button closes the menu first and only a second click closes the dialog.Qt Code:
... delete menu;To copy to clipboard, switch view to plain text mode
1) Can I just omit the line "delete menu"? Would it create a memory leak if the menu is closed regularly?
2) Is there some way to determine if a QObject still exists or is already destroyed?
Bookmarks