File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -411,6 +411,7 @@ impl RawLua {
411
411
unsafe extern "C-unwind" fn global_hook_proc ( state : * mut ffi:: lua_State , ar : * mut ffi:: lua_Debug ) {
412
412
let status = callback_error_ext ( state, ptr:: null_mut ( ) , move |extra, _| {
413
413
let rawlua = ( * extra) . raw_lua ( ) ;
414
+ let _guard = StateGuard :: new ( rawlua, state) ;
414
415
let debug = Debug :: new ( rawlua, ar) ;
415
416
match ( * extra) . hook_callback . take ( ) {
416
417
Some ( hook_cb) => {
@@ -440,6 +441,7 @@ impl RawLua {
440
441
441
442
let status = callback_error_ext ( state, ptr:: null_mut ( ) , |extra, _| {
442
443
let rawlua = ( * extra) . raw_lua ( ) ;
444
+ let _guard = StateGuard :: new ( rawlua, state) ;
443
445
let debug = Debug :: new ( rawlua, ar) ;
444
446
match get_internal_userdata :: < HookCallback > ( state, -1 , ptr:: null ( ) ) . as_ref ( ) {
445
447
Some ( hook_cb) => hook_cb ( ( * extra) . lua ( ) , debug) ,
Original file line number Diff line number Diff line change @@ -608,10 +608,10 @@ async fn test_async_hook() -> Result<()> {
608
608
static HOOK_CALLED : AtomicBool = AtomicBool :: new ( false ) ;
609
609
lua. set_global_hook ( mlua:: HookTriggers :: new ( ) . every_line ( ) , move |_, _| {
610
610
if !HOOK_CALLED . swap ( true , Ordering :: Relaxed ) {
611
- Ok ( mlua:: VmState :: Yield )
612
- } else {
613
- Ok ( mlua:: VmState :: Continue )
611
+ #[ cfg( any( feature = "lu53" , feature = "lua54" ) ) ]
612
+ return Ok ( mlua:: VmState :: Yield ) ;
614
613
}
614
+ Ok ( mlua:: VmState :: Continue )
615
615
} ) ?;
616
616
617
617
let sleep = lua. create_async_function ( move |_lua, n : u64 | async move {
You can’t perform that action at this time.
0 commit comments