File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -489,7 +489,7 @@ impl RawLua {
489489 #[ cfg( feature = "luau" ) ]
490490 ffi:: lua_resetthread ( thread_state) ;
491491 extra. thread_pool . push ( thread. 0 . index ) ;
492- thread. 0 . drop = false ;
492+ thread. 0 . index = 0 ; // Prevent reference from being dropped
493493 return true ;
494494 }
495495 false
Original file line number Diff line number Diff line change @@ -115,7 +115,6 @@ pub(crate) struct DestructedUserdata;
115115pub ( crate ) struct ValueRef {
116116 pub ( crate ) lua : WeakLua ,
117117 pub ( crate ) index : c_int ,
118- pub ( crate ) drop : bool ,
119118}
120119
121120impl ValueRef {
@@ -124,7 +123,6 @@ impl ValueRef {
124123 ValueRef {
125124 lua : lua. weak ( ) . clone ( ) ,
126125 index,
127- drop : true ,
128126 }
129127 }
130128
@@ -149,7 +147,7 @@ impl Clone for ValueRef {
149147
150148impl Drop for ValueRef {
151149 fn drop ( & mut self ) {
152- if self . drop {
150+ if self . index > 0 {
153151 if let Some ( lua) = self . lua . try_lock ( ) {
154152 unsafe { lua. drop_ref ( self ) } ;
155153 }
You can’t perform that action at this time.
0 commit comments