@@ -568,34 +568,19 @@ mod script_instance_info {
568
568
p_instance : sys:: GDExtensionScriptInstanceDataPtr ,
569
569
p_prop_info : * const sys:: GDExtensionPropertyInfo ,
570
570
) {
571
- let ctx = || {
572
- format ! (
573
- "error while calling {}::get_property_list" ,
574
- type_name:: <T >( )
575
- )
576
- } ;
577
-
578
- let length = handle_panic ( ctx, || {
579
- let instance = instance_data_as_script_instance :: < T > ( p_instance) ;
580
-
581
- borrow_instance ( instance) . get_property_list ( ) . len ( )
582
- } )
583
- . unwrap_or_default ( ) ;
584
-
585
- // SAFETY: p_prop_info is expected to have been created by get_property_list_func
586
- // and therefore should have the same length as before. get_propery_list_func
587
- // also guarantees that both vector length and capacity are equal.
588
- let _drop = transfer_ptr_list_from_godot ( p_prop_info, length) ;
589
-
590
- // now drop the backing data
591
571
let instance = instance_data_as_script_instance :: < T > ( p_instance) ;
592
572
593
- let _drop = instance
573
+ let vec = instance
594
574
. property_list
595
575
. lock ( )
596
576
. expect ( "mutex should not be poisoned" )
597
577
. remove ( & p_prop_info)
598
- . expect ( "we can not free a list that has not been allocated" ) ;
578
+ . expect ( "Godot is trying to free the property list, but none has been set" ) ;
579
+
580
+ // SAFETY: p_prop_info is expected to have been created by get_property_list_func
581
+ // and therefore should have the same length as before. get_propery_list_func
582
+ // also guarantees that both vector length and capacity are equal.
583
+ let _drop = transfer_ptr_list_from_godot ( p_prop_info, vec. len ( ) ) ;
599
584
}
600
585
601
586
/// # Safety
@@ -706,20 +691,20 @@ mod script_instance_info {
706
691
p_instance : sys:: GDExtensionScriptInstanceDataPtr ,
707
692
p_method_info : * const sys:: GDExtensionMethodInfo ,
708
693
) {
709
- let ctx = || format ! ( "error while calling {}::get_method_list" , type_name:: <T >( ) ) ;
710
-
711
- let length = handle_panic ( ctx, || {
712
- let instance = instance_data_as_script_instance :: < T > ( p_instance) ;
694
+ let instance = instance_data_as_script_instance :: < T > ( p_instance) ;
713
695
714
- borrow_instance ( instance) . get_method_list ( ) . len ( )
715
- } )
716
- . unwrap_or_default ( ) ;
696
+ let vec = instance
697
+ . method_list
698
+ . lock ( )
699
+ . expect ( "method_list mutex should not be poisoned" )
700
+ . remove ( & p_method_info)
701
+ . expect ( "Godot is trying to free the method_list, but none has been set" ) ;
717
702
718
703
// SAFETY: p_method_info is expected to have been created by get_method_list_func and therefore should have the same length as before.
719
704
// get_method_list_func also guarantees that both vector length and capacity are equal.
720
- let vec = transfer_ptr_list_from_godot ( p_method_info, length ) ;
705
+ let vec_sys = transfer_ptr_list_from_godot ( p_method_info, vec . len ( ) ) ;
721
706
722
- vec . into_iter ( ) . for_each ( |method_info| {
707
+ vec_sys . into_iter ( ) . for_each ( |method_info| {
723
708
transfer_ptr_list_from_godot (
724
709
method_info. arguments ,
725
710
method_info. argument_count as usize ,
0 commit comments