[PATCH] msvcrt: fix handling of multiple nested exceptions

Peter Beutner p.beutner at gmx.net
Fri Feb 17 04:52:15 CST 2006


Save in each nested frame a pointer to the original exception record.
Only one refence in thread_data isn't enough when we have multiple nested
frames.

note: it should be possible to get rid completely of the "thread_data()->exc_record".
It's only been used by CxxDetectRethrow now. But I haven't seen any app yet which
actually uses this function nor managed to create some code with cl.exe which uses it.
So with no idea how to test it, i didn't want to modify it :/.

---

 dlls/msvcrt/cppexcept.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

c343cb85e8677a39ffb140fc5b3bba4f4270a4f9
diff --git a/dlls/msvcrt/cppexcept.c b/dlls/msvcrt/cppexcept.c
index 1ca8518..66c6aa7 100644
--- a/dlls/msvcrt/cppexcept.c
+++ b/dlls/msvcrt/cppexcept.c
@@ -229,6 +229,7 @@ struct catch_func_nested_frame
     cxx_exception_frame          *cxx_frame; /* frame of parent exception */
     cxx_function_descr           *descr;     /* descriptor of parent exception */
     int                           trylevel;  /* current try level */
+    EXCEPTION_RECORD             *rec;       /* rec associated with frame */
 };
 
 /* handler for exceptions happening while calling a catch function */
@@ -247,7 +248,7 @@ static DWORD catch_function_nested_handl
 
     if(rec->ExceptionCode == CXX_EXCEPTION)
     {
-        PEXCEPTION_RECORD prev_rec = msvcrt_get_thread_data()->exc_record;
+        PEXCEPTION_RECORD prev_rec = nested_frame->rec;
         if(rec->ExceptionInformation[1] == 0 && rec->ExceptionInformation[2] == 0)
         {
             /* exception was rethrown */
@@ -330,6 +331,7 @@ inline static void call_catch_block( PEX
             nested_frame.cxx_frame = frame;
             nested_frame.descr     = descr;
             nested_frame.trylevel  = nested_trylevel + 1;
+            nested_frame.rec = rec;
 
             __wine_push_frame( &nested_frame.frame );
             thread_data->exc_record = rec;
-- 
1.2.0




More information about the wine-patches mailing list