https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1f8eda78537507e5b3ec41941ef896d72a87aea8

commit 1f8eda78537507e5b3ec41941ef896d72a87aea8
Author:     winesync <[email protected]>
AuthorDate: Mon Jan 9 22:08:05 2023 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Aug 19 23:50:52 2023 +0300

    [WINESYNC] msvcrt: Fix handling tryblocks inside current catch block on 
nested exception.
    
    Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48335
    Signed-off-by: Piotr Caban <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 6babdb5508bd2f1b659218483f5df76859898712 by Piotr Caban 
<[email protected]>
---
 sdk/lib/crt/wine/except_i386.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sdk/lib/crt/wine/except_i386.c b/sdk/lib/crt/wine/except_i386.c
index d3bcc3aaadd..7512196c096 100644
--- a/sdk/lib/crt/wine/except_i386.c
+++ b/sdk/lib/crt/wine/except_i386.c
@@ -389,7 +389,7 @@ static DWORD catch_function_nested_handler( 
EXCEPTION_RECORD *rec, EXCEPTION_REG
 /* returns the address to continue execution to after the catch block was 
called */
 static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
                                      cxx_exception_frame *frame,
-                                     const cxx_function_descr *descr, int 
nested_trylevel,
+                                     const cxx_function_descr *descr,
                                      catch_func_nested_frame *catch_frame,
                                      cxx_exception_type *info )
 {
@@ -407,7 +407,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, 
CONTEXT *context,
         const tryblock_info *tryblock = &descr->tryblock[i];
 
         /* only handle try blocks inside current catch block */
-        if (catch_frame && nested_trylevel > tryblock->start_level) continue;
+        if (catch_frame && catch_frame->trylevel > tryblock->start_level) 
continue;
 
         if (trylevel < tryblock->start_level) continue;
         if (trylevel > tryblock->end_level) continue;
@@ -458,7 +458,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, 
CONTEXT *context,
             nested_frame.frame.Handler = catch_function_nested_handler;
             nested_frame.cxx_frame = frame;
             nested_frame.descr     = descr;
-            nested_frame.trylevel  = nested_trylevel + 1;
+            nested_frame.trylevel  = tryblock->end_level + 1;
 
             __wine_push_frame( &nested_frame.frame );
             addr = call_handler( catchblock->handler, &frame->ebp );
@@ -545,7 +545,7 @@ static LONG CALLBACK se_translation_filter( 
EXCEPTION_POINTERS *ep, void *c )
 
     exc_type = (cxx_exception_type *)rec->ExceptionInformation[2];
     call_catch_block( rec, ep->ContextRecord, ctx->frame, ctx->descr,
-            ctx->frame->trylevel, ctx->nested_frame, exc_type );
+            ctx->nested_frame, exc_type );
 
     __DestructExceptionObject( rec );
     return ExceptionContinueSearch;
@@ -642,7 +642,7 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, 
cxx_exception_frame* frame
     }
 
     call_catch_block( rec, context, frame, descr,
-            frame->trylevel, nested_frame, exc_type );
+            nested_frame, exc_type );
     return ExceptionContinueSearch;
 }
 

Reply via email to