Exceptions and Access Violations in Paint events in Windows

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-05-25T12:03:06Z Indexed on 2010/05/25 12:21 UTC
Read the original article Hit count: 315

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

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows