@@ -37,7 +37,7 @@ mod single_threaded {
3737 /// Manages storage and lifecycle of user's extension class instances.
3838 pub struct InstanceStorage < T : GodotClass > {
3939 user_instance : cell:: RefCell < T > ,
40- base : Base < T :: Base > ,
40+ pub ( super ) base : Base < T :: Base > ,
4141
4242 // Declared after `user_instance`, is dropped last
4343 pub ( super ) lifecycle : cell:: Cell < Lifecycle > ,
@@ -160,7 +160,7 @@ mod multi_threaded {
160160 /// Manages storage and lifecycle of user's extension class instances.
161161 pub struct InstanceStorage < T : GodotClass > {
162162 user_instance : sync:: RwLock < T > ,
163- base : Base < T :: Base > ,
163+ pub ( super ) base : Base < T :: Base > ,
164164
165165 // Declared after `user_instance`, is dropped last
166166 pub ( super ) lifecycle : AtomicLifecycle ,
@@ -256,6 +256,12 @@ mod multi_threaded {
256256}
257257
258258impl < T : GodotClass > InstanceStorage < T > {
259+ pub fn debug_info ( & self ) -> String {
260+ // Unlike get_gd(), this doesn't require special trait bounds.
261+
262+ format ! ( "{:?}" , self . base)
263+ }
264+
259265 #[ must_use]
260266 pub fn into_raw ( self ) -> * mut Self {
261267 Box :: into_raw ( Box :: new ( self ) )
@@ -268,18 +274,20 @@ impl<T: GodotClass> InstanceStorage<T> {
268274 ) ;
269275 self . lifecycle . set ( Lifecycle :: Destroying ) ;
270276 out ! (
271- " mark; self={:?}, val={:?}" ,
277+ " mark; self={:?}, val={:?}, obj={:?} " ,
272278 self as * const _,
273- self . lifecycle. get( )
279+ self . lifecycle. get( ) ,
280+ self . base,
274281 ) ;
275282 }
276283
277284 #[ inline( always) ]
278285 pub fn destroyed_by_godot ( & self ) -> bool {
279286 out ! (
280- " is_d; self={:?}, val={:?}" ,
287+ " is_d; self={:?}, val={:?}, obj={:?} " ,
281288 self as * const _,
282- self . lifecycle. get( )
289+ self . lifecycle. get( ) ,
290+ self . base,
283291 ) ;
284292 matches ! (
285293 self . lifecycle. get( ) ,
@@ -325,7 +333,9 @@ pub unsafe fn destroy_storage<T: GodotClass>(instance_ptr: sys::GDExtensionClass
325333
326334 assert ! (
327335 !( * raw) . is_bound( ) ,
328- "tried to destroy object while a bind() or bind_mut() call is active"
336+ "tried to destroy object while a bind() or bind_mut() call is active\n \
337+ object: {}",
338+ ( * raw) . debug_info( )
329339 ) ;
330340
331341 let _drop = Box :: from_raw ( raw) ;
0 commit comments