From cb013604a924dcbdb5026c7e886d717d82f89f04 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 25 Aug 2020 19:58:28 -0400 Subject: [PATCH] jump_fcontext should set the outValue of fiber being switched to rather the one being switched from Fixes #5162 --- thirdparty/libcontext/libcontext.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/thirdparty/libcontext/libcontext.cpp b/thirdparty/libcontext/libcontext.cpp index 7de0e20e3e..9e90895d31 100644 --- a/thirdparty/libcontext/libcontext.cpp +++ b/thirdparty/libcontext/libcontext.cpp @@ -1297,10 +1297,9 @@ fcontext_t LIBCONTEXT_CALL_CONVENTION make_fcontext(void* sp, size_t size, void( intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext(fcontext_t* ofc, fcontext_t nfc, intptr_t vp, bool preserve_fpu) { - auto current = (void*)GetCurrentFiber(); - fiberParams[current].outValue = vp; *ofc = GetCurrentFiber(); fiberParams[nfc].inValue = vp; + fiberParams[nfc].outValue = vp; SwitchToFiber(nfc); return fiberParams[*ofc].outValue; }