Skip to content

Dont catch unhandled exceptions#4

Open
lanurmi wants to merge 2 commits intomasterfrom
dont-catch-unhandled-exceptions
Open

Dont catch unhandled exceptions#4
lanurmi wants to merge 2 commits intomasterfrom
dont-catch-unhandled-exceptions

Conversation

@lanurmi
Copy link
Owner

@lanurmi lanurmi commented Dec 9, 2024

No description provided.

@lanurmi
Copy link
Owner Author

lanurmi commented Dec 9, 2024

A patch for triggering a crash (abort)

Minimal sample: Help -> About
Threads sample: Thread -> Start a new thread

lanurmi added 2 commits March 11, 2025 14:17
Leaving wxTRY blocks with only a few lines of code as-is, but refactoring
those with non-trivial amount of codelines into functions.
Add a system option to control whether the main loop and threads are run
from within a try-catch block, or outside of it.

Traditionally, wxWidgets has caught all unhandled C++ exceptions
that are about to cause the program to be aborted.

For many situations this is probably a good thing, but the downside
is that it severely complicates debugging the source of such exceptions.
The backtrace will only show the stack since wx's exception handler,
but not where the exception occurred in the first place.

Any crashdumps created by the OS also suffer from the same issue;
backtraces are mostly useless in these cases.

The following classes with try-catch blocks do not obey the new system
option for now: wxDataViewRendererBase, wxDocTemplate, wxIDropTarget
@lanurmi lanurmi force-pushed the dont-catch-unhandled-exceptions branch from 1c173a8 to c8980d5 Compare March 11, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant