Christopher Pisz <
nos...@notanaddress.com> wrote in news:ma8mse$gv4$1
@
dont-email.me:
Access violation is most usually caused by the program invoking Undefined
Behavior, so anything can happen. Typically, in Linux world you could be
pretty certain the process is killed in spot by the OS. However, in
Windows world this is not so simple, the program can define handlers for
"handling" these kind of errors. Windows also likes to display (mostly
unhelpful) dialog boxes, sometimes offering a possibility to attach a
debugger. As "anything can happen", all these behaviors are legal.
Terminating a single thread is not an option as this is pretty much
guaranteed to leave the process in an inconsistent state.
Another a bit more reliable way is to "handle and ignore" the error,
there are even Windows SDK idioms which actually do that in an
encapsulated way (IsBadReadPtr() and friends) which can be greatly abused
by crappy programs for hiding their bugs. If you can continue the program
in the debugger after the access violation and nothing bad seems to
happen, this probably means the code has "handled" the access violation
in this or a similar way.
Note that even if the problem appears in a foreign thread it does not
mean that your code is not to blame. It could have passed some invalid
data to the foregin thread directly or indirectly.
hth
Paavo