Exceptions thrown from the main loop in wxOSX are silently discarded (Issue #26150)

30 views
Skip to first unread message

VZ

unread,
Feb 2, 2026, 6:38:51 AMFeb 2
to wx-...@googlegroups.com, Subscribed
vadz created an issue (wxWidgets/wxWidgets#26150)

The problem can be easily seen in the "except" sample: choosing "Throw unhandled exception" menu item results in the application silently exiting with 0 exit code without any other messages.

This is wrong, it should display the exception in some way (under Windows it shows a message box and under Linux it at least prints something to stderr) and it definitely shouldn't exit with success exit code.

Looking at the code, this seems to be due to wxAppConsoleBase::RethrowStoredException() never being called under Mac. Under other platforms it is called from either wxEventLoopManual::ProcessEvents() or wxGUIEventLoop::DoRun() (wxGTK). We probably need to call it from either wxCFEventLoop::DoRun() or wxCFEventLoop::OSXDoRun().


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26150@github.com>

Stefan Csomor

unread,
Feb 2, 2026, 9:42:45 AMFeb 2
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26150)

In the sample the StoreCurrentException overload throws, but this called from WXConsumeException without a try catch guard in scope .. so the app exits


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26150/3835544559@github.com>

VZ

unread,
Feb 2, 2026, 9:45:17 AMFeb 2
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26150)

I have to admit that I didn't really debug the sample, but I checked that it behaved differently from wxGTK where it exits with the error message and 255 exit code.

I did debug dialogs sample after replacing [] with .at() in wxFileDialog code and there is just exits silently too, which is definitely not expected.

As I wrote, I think it's because RethrowStoredException() is never called in wxOSX: the idea was that the exception could be temporarily stored but would be rethrown later if nobody did anything about it. And in wxOSX it just ends up being ignored.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26150/3835559024@github.com>

Stefan Csomor

unread,
Feb 2, 2026, 9:56:04 AMFeb 2
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#26150)

we are in WXConsumeException in the outer catch part, now the StoreCurrentException below throws, and I don't see where this should lead to an exception being stored ...

        bool stored = false;
        try
        {
            if ( wxTheApp )
                stored = wxTheApp->StoreCurrentException();
        }
        catch ( ... )
        {
            // StoreCurrentException() really shouldn't throw, but if it
            // did, take it as an indication that it didn't store it.
        }


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26150/3835619767@github.com>

Ryan Ogurek

unread,
Mar 16, 2026, 6:30:24 AM (2 days ago) Mar 16
to wx-...@googlegroups.com, Subscribed
ryancog left a comment (wxWidgets/wxWidgets#26150)

This seems fixed by #26157
At least, I now see the usual debug alert dialog instead of silence.

Is there some other issue that hasn't been resolved (or is this issue just stale)?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26150/4066666184@github.com>

VZ

unread,
Mar 16, 2026, 8:59:21 AM (2 days ago) Mar 16
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26150)

Thanks, it's indeed supposed to be fixed and we just forgot to close this one.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26150/4067486954@github.com>

VZ

unread,
Mar 16, 2026, 8:59:22 AM (2 days ago) Mar 16
to wx-...@googlegroups.com, Subscribed

Closed #26150 as completed.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/26150/issue_event/23606692817@github.com>

Reply all
Reply to author
Forward
0 new messages