@@ -156,7 +156,6 @@ impl Thread {
156156        let  thread_state = self . state ( ) ; 
157157        unsafe  { 
158158            let  _sg = StackGuard :: new ( state) ; 
159-             let  _thread_sg = StackGuard :: with_top ( thread_state,  0 ) ; 
160159
161160            let  nargs = args. push_into_stack_multi ( & lua) ?; 
162161            if  nargs > 0  { 
@@ -165,6 +164,7 @@ impl Thread {
165164                pushed_nargs += nargs; 
166165            } 
167166
167+             let  _thread_sg = StackGuard :: with_top ( thread_state,  0 ) ; 
168168            let  ( _,  nresults)  = self . resume_inner ( & lua,  pushed_nargs) ?; 
169169            check_stack ( state,  nresults + 1 ) ?; 
170170            ffi:: lua_xmove ( thread_state,  state,  nresults) ; 
@@ -192,12 +192,12 @@ impl Thread {
192192        let  thread_state = self . state ( ) ; 
193193        unsafe  { 
194194            let  _sg = StackGuard :: new ( state) ; 
195-             let  _thread_sg = StackGuard :: with_top ( thread_state,  0 ) ; 
196195
197196            check_stack ( state,  1 ) ?; 
198197            error. push_into_stack ( & lua) ?; 
199198            ffi:: lua_xmove ( state,  thread_state,  1 ) ; 
200199
200+             let  _thread_sg = StackGuard :: with_top ( thread_state,  0 ) ; 
201201            let  ( _,  nresults)  = self . resume_inner ( & lua,  ffi:: LUA_RESUMEERROR ) ?; 
202202            check_stack ( state,  nresults + 1 ) ?; 
203203            ffi:: lua_xmove ( thread_state,  state,  nresults) ; 
0 commit comments