Timothy Madden
2010-09-23 17:08:59 UTC
Hello
I have an application where MFC callback functions use to catch
everythig with catch(...) and then simply call my GlobalErrorHandler()
that will throw; and catch the exception again, this time with a
specific exception type.
That is, GlobalErrorHandler knows about as many exception types as my
application can handle, and all callback functions just catch(...) once
without the specific type and then invoke GlobalErrorHandler(), which
will then get the type.
Recently I run into a strange problem with this approach, however. After
the rethrow the program auto-magically rebuilds the entire call stack
from the time of the original throw, and attempts to destroy local
variables in the call stack again. So my application then crashes.
Why would VC++ call destructors again at re-throw ? How can it rebuild
the call stack ? Has anyone run into this problem before ?
Thank you,
Timothy Madden
I have an application where MFC callback functions use to catch
everythig with catch(...) and then simply call my GlobalErrorHandler()
that will throw; and catch the exception again, this time with a
specific exception type.
That is, GlobalErrorHandler knows about as many exception types as my
application can handle, and all callback functions just catch(...) once
without the specific type and then invoke GlobalErrorHandler(), which
will then get the type.
Recently I run into a strange problem with this approach, however. After
the rethrow the program auto-magically rebuilds the entire call stack
from the time of the original throw, and attempts to destroy local
variables in the call stack again. So my application then crashes.
Why would VC++ call destructors again at re-throw ? How can it rebuild
the call stack ? Has anyone run into this problem before ?
Thank you,
Timothy Madden