File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ macro_rules! impl_signature_for_tuple {
163
163
. unwrap_or_else( |e| return_error:: <$R>( method_name, & e) ) ;
164
164
165
165
// FIXME is inc_ref needed here?
166
- // std::mem::forget(ret_val);
166
+ std:: mem:: forget( ret_val) ;
167
167
}
168
168
}
169
169
} ;
Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ macro_rules! gdext_ptrcall {
414
414
415
415
<$( $RetTy) + as sys:: GodotFfi >:: write_sys( & ret_val, $ret) ;
416
416
// FIXME is inc_ref needed here?
417
- // #[allow(clippy::forget_copy)]
418
- // std::mem::forget(ret_val);
417
+ #[ allow( clippy:: forget_copy) ]
418
+ std:: mem:: forget( ret_val) ;
419
419
} ;
420
420
}
Original file line number Diff line number Diff line change @@ -40,7 +40,8 @@ impl<T: GodotClass> Base<T> {
40
40
assert ! ( !base_ptr. is_null( ) , "instance base is null pointer" ) ;
41
41
42
42
// Initialize only as weak pointer (don't increment reference count)
43
- let obj = Gd :: from_obj_sys_weak ( base_ptr) ;
43
+
44
+ let obj = Gd :: from_obj_sys ( base_ptr) ;
44
45
45
46
// This obj does not contribute to the strong count, otherwise we create a reference cycle:
46
47
// 1. RefCounted (dropped in GDScript)
Original file line number Diff line number Diff line change @@ -86,11 +86,17 @@ where
86
86
where
87
87
T : cap:: GodotInit ,
88
88
{
89
- unsafe {
89
+ let result = unsafe {
90
90
let object_ptr = callbacks:: create :: < T > ( ptr:: null_mut ( ) ) ;
91
91
Gd :: from_obj_sys ( object_ptr)
92
+ } ;
93
+
94
+
95
+ T :: Mem :: maybe_init_ref ( & result) ;
96
+ result
92
97
}
93
- }
98
+
99
+
94
100
95
101
/// Creates a `Gd<T>` using a function that constructs a `T` from a provided base.
96
102
///
You can’t perform that action at this time.
0 commit comments