Quitting from OS X Dock crashes applications with modal dialog
|Reported by:||pfriis||Owned by:|
When an application is running in the modal loop for a dialog Cmd-Q and the menu is correctly disabled, but it is still possible to right click the icon in the Dock and choose "Quit". which in turn crashes the application.
Easily reproducible in "dialogs" sample. Open a modal dialog and quit from dock. Pooof.
Apple themselves seem to have the variant of the same issue. Opening "Preferences" in iTunes and then quitting from Dock seems to do nothing... until the Preferences window is closed and iTunes disappears from the screen ...
I have fixed the issue locally in my application by maintaining a pointer to modal dialogs and then do the following trick:
void MainFrame::OnFileExit(wxCommandEvent& e)
if (m_pModalWindow && !m_pModalWindow->Close(true))
..but this is hardly a solution that could be built into the core.
There is a global list of all modal dialogs (wxModalDialogs), but I am not sure if it is usable for this purpose.