Exceptions and Access Violations in Paint events in Windows
- by Patrick
After executing some new code, my C++ application started to behave strange (incorrect or incomplete screen updates, sometimes no screen updates at all).
After a while we found out that the new code is causing an Access Violation. Strange enough, the application simply keeps on running (but with the incorrect screen updates).
At first we thought the problem was caused by a "try-catch(...)" construction (put there by an overactive ex-colleague), but several hours later (carefully inspecting the call stacks, adding many breakpoints, ...) we found out that if there's an Access Violation in a paint event, Windows catches it, and simply continues running the application.
Is this normal behavior?
Is it normal that Windows catches exceptions/errors during a paint event?
Is there a way to disable this? (if not, it would mean that we have to always run in the debugger with all exceptions enabled while testing our code).
Patrick