New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac: quitting the application from the dock bypasses OnExit if SetExitOnFrameDelete is false #16200
Labels
Comments
2014-04-22 15:01:56: joostn (Joost Nieuwenhuijse) uploaded file
|
2014-04-22 15:02:16: joostn (Joost Nieuwenhuijse) uploaded file
|
2014-04-22 16:14:07: joostn (Joost Nieuwenhuijse) commentedMy patch doesn't work correctly, it results in OnExit being called before all windows have been destroyed. Stefan, I think you know how to fix this better than I do? |
2014-04-22 21:40:47: @csomor changed status from new to accepted |
2014-04-25 09:38:02: dgud commentedCan this fix be added WX_3_0_BRANCH also, please? |
utelle
pushed a commit
to utelle/wxWidgets
that referenced
this issue
Aug 18, 2022
…xWidgets#16200 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue migrated from trac ticket # 16200
component: wxOSX (any toolkit) | priority: normal | resolution: fixed | keywords: OnExit SetExitOnFrameDelete
2014-04-22 15:01:06: joostn (Joost Nieuwenhuijse) created the issue
See attached minimal sample: if we do Quit from the app's context menu in the dock, OnExit never gets called. Instead exit() is called which proceeds to delete all global objects. This only happens if we set wxApp::SetExitOnFrameDelete(false).
This is what I think what happens: if ExitOnFrameDelete is true, wxApp::OSXOnShouldTerminate closes the main window, which in turns calls wxApp::ExitMainLoop(). Upon exiting the main loop, wxApp::OnExit is called. If ExitOnFrameDelete is false, ExitMainLoop doesn't get called. NSApplication will call OSXOnWillTerminate -> [NSApplication terminate] -> exit(), completely bypassing wxwidgets cleanup.
I've made a patch which seems to fix it but I'm not sure if this is the right solution.
On a side note, if I understand things correctly, it is never OK if wxApp::OSXOnWillTerminate gets called. So we could place a wxASSERT there. And OSXOnShouldTerminate should always return false to ensure that the normal wx cleanup sequence is performed. Right?
The text was updated successfully, but these errors were encountered: