wxOSX perform cleanup when applicationWillTerminate: is called (PR #26542)

26 views
Skip to first unread message

Ryan Ogurek

unread,
Jun 1, 2026, 2:52:46 AM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed

In the handling of OSXOnWillTerminate(), the TLW is Close()d, but not deleted (the pending cleanup never occurs), additionally, OnExit() is never called.

When clicking "Quit" from the Dock, Cocoa ends up in -[NSApplication terminate:], which calls exit(0) more or less immediately after sending applicationWillTerminate:, and the documentation reads:

Don’t bother to put final cleanup code in your app’s main() function—it will never be executed. If cleanup is necessary, perform that cleanup in the delegate’s applicationWillTerminate: method.

So then, this PR changes wxOSX's wxApp::OnEndSession() to do cleanup similarly to the wxMSW port, making sure that OnExit() and all other cleanup is performed (part of that cleanup is deleting TLWs, so I've removed the Close()).


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26542

Commit Summary

  • b871033 wxOSX perform cleanup when applicationWillTerminate: is called

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26542@github.com>

VZ

unread,
Jun 1, 2026, 8:14:33 AM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed

@vadz approved this pull request.

Thanks, assuming the comment is correct about there being no better place to do this, this looks the right thing to do to me.

Of course, as always, I'd prefer @csomor's confirmation before merging this if possible.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26542/review/4401058973@github.com>

Stefan Csomor

unread,
Jun 1, 2026, 9:57:45 AM (2 days ago) Jun 1
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26542)

Actually, the sequence of calling all the app callbacks was once preserved. I'll have to investigate.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26542/c4593265640@github.com>

Stefan Csomor

unread,
Jun 2, 2026, 11:12:47 AM (yesterday) Jun 2
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26542)

Ok, some flows are not the way they used to be, the system does not emulate a quit-app apple event anymore, but still putting these things in wxApp::OnEndSession seems too general to me, I'd rather add

    wxTheApp->CallOnExit();
    wxEntryCleanup();

at the end of - (void)applicationWillTerminate: directly, since for this we are given the contract, that exit will soon be called


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26542/c4603794430@github.com>

Ryan Ogurek

unread,
Jun 2, 2026, 12:44:52 PM (yesterday) Jun 2
to wx-...@googlegroups.com, Subscribed
ryancog left a comment (wxWidgets/wxWidgets#26542)

@csomor Would you still want to keep the TLW Close in OnEndSession()? I’m not sure what problem is solved having that there…


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26542/c4604636109@github.com>

Reply all
Reply to author
Forward
0 new messages