Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#11731 closed defect (fixed)

Quitting from OS X Dock crashes applications with modal dialog

Reported by: pfriis Owned by:
Priority: normal Milestone:
Component: wxOSX-Carbon Version: 2.9.0
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

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))

return;

Close();

}

..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.

Change History (4)

comment:1 Changed 4 years ago by csomor

  • Resolution set to fixed
  • Status changed from new to closed

modal dialogs are now tracked, and quitting the app is blocked as long as there are modal dialogs open

thanks for the report

comment:2 Changed 4 years ago by kjones@…

I would really like to get my hands on a patch for this bug.

The ticket information for this bug says "Component: wxOSX-Carbon", yet the version says "2.9.0". I was unaware that wxWidgets 2.9 for Mac OS X was still using Carbon.

Is there a fix for this Dock-Quit crash available for wxWidgets 2.8 ?

I have searched the svn commit logs for:

http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk

--and--

http://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH

and I have not located the code by csomor that fixes this bug.

Can someone please help me find it?

comment:3 Changed 4 years ago by csomor

wxWidgets 2.9 is available with carbon and with cocoa, if you don't indicate which, it still defaults to carbon.

you'll have to backport things

r64068 -> counting the number of open modal dialogs

r64094 if wxDialog::OSXHasModalDialogsOpen returns true, quit won't succeed

comment:4 Changed 4 years ago by kjones@…

Thank you very much. I have located those two revisions and will backport them to my copy of 2.8. This is much appreciated.

Note: See TracTickets for help on using tickets.