diff --git a/src/core/c-do.c b/src/core/c-do.c index eaf6885062..4b928faa15 100644 --- a/src/core/c-do.c +++ b/src/core/c-do.c @@ -1082,9 +1082,12 @@ x*/ static REBINT Do_Args_Light(REBVAL *func, REBVAL *path, REBSER *block, REBCN { REBOL_STATE state; REBVAL *tos; + jmp_buf *Last_Halt_State = Halt_State; PUSH_STATE(state, Saved_State); if (SET_JUMP(state)) { + /* Halt_State might become invalid, restore the one above */ + Halt_State = Last_Halt_State; POP_STATE(state, Saved_State); Catch_Error(DS_NEXT); // Stores error value here return TRUE; @@ -1662,6 +1665,7 @@ x*/ static REBINT Do_Args_Light(REBVAL *func, REBVAL *path, REBSER *block, REBCN { REBOL_STATE state; REBVAL *val; + jmp_buf *Last_Saved_State = Saved_State; // static D = 0; // int depth = D++; @@ -1670,6 +1674,8 @@ x*/ static REBINT Do_Args_Light(REBVAL *func, REBVAL *path, REBSER *block, REBCN PUSH_STATE(state, Halt_State); if (SET_JUMP(state)) { // Debug_Fmt("Throw Halt %d", depth); + /* Saved_State might become invalid, restore the one above */ + Saved_State = Last_Saved_State; POP_STATE(state, Halt_State); Catch_Error(DS_NEXT); // Stores error value here return TRUE; diff --git a/src/tests/units/crash-test.r3 b/src/tests/units/crash-test.r3 index 7c13aa85ac..44b833dfa3 100644 --- a/src/tests/units/crash-test.r3 +++ b/src/tests/units/crash-test.r3 @@ -8,7 +8,7 @@ Rebol [ ~~~start-file~~~ "Crash tests" -===start-group=== "Series crashes" +===start-group=== "Crashing issues" --test-- "DH keys generation" ;@@ situation fixed in: https://github.com/zsx/r3/commit/cc625bebcb6038b9282876954f929c9d80048d2b @@ -28,6 +28,11 @@ Rebol [ a: func [/b] [1] --assert error? try [a/b/%] ;- no crash, just error! +--test-- "issue-2190" + ;@@ https://github.com/Oldes/Rebol-issues/issues/2190 + catch/quit [ attempt [ quit ] ] + --assert error? try [print x] ;- no crash, just error! + ===end-group=== ~~~end-file~~~ \ No newline at end of file