File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -264,21 +264,33 @@ pub mod mem {
264
264
impl Memory for DynamicRefCount {
265
265
fn maybe_init_ref < T : GodotClass > ( obj : & Gd < T > ) {
266
266
out ! ( " Dyn::init <{}>" , std:: any:: type_name:: <T >( ) ) ;
267
- if obj. instance_id ( ) . is_ref_counted ( ) {
268
- StaticRefCount :: maybe_init_ref ( obj) ;
267
+ if obj
268
+ . instance_id_or_none ( )
269
+ . map ( |id| id. is_ref_counted ( ) )
270
+ . unwrap_or ( false )
271
+ {
272
+ StaticRefCount :: maybe_init_ref ( obj)
269
273
}
270
274
}
271
275
272
276
fn maybe_inc_ref < T : GodotClass > ( obj : & Gd < T > ) {
273
277
out ! ( " Dyn::inc <{}>" , std:: any:: type_name:: <T >( ) ) ;
274
- if obj. instance_id ( ) . is_ref_counted ( ) {
275
- StaticRefCount :: maybe_inc_ref ( obj) ;
278
+ if obj
279
+ . instance_id_or_none ( )
280
+ . map ( |id| id. is_ref_counted ( ) )
281
+ . unwrap_or ( false )
282
+ {
283
+ StaticRefCount :: maybe_inc_ref ( obj)
276
284
}
277
285
}
278
286
279
287
fn maybe_dec_ref < T : GodotClass > ( obj : & Gd < T > ) -> bool {
280
288
out ! ( " Dyn::dec <{}>" , std:: any:: type_name:: <T >( ) ) ;
281
- if obj. instance_id ( ) . is_ref_counted ( ) {
289
+ if obj
290
+ . instance_id_or_none ( )
291
+ . map ( |id| id. is_ref_counted ( ) )
292
+ . unwrap_or ( false )
293
+ {
282
294
StaticRefCount :: maybe_dec_ref ( obj)
283
295
} else {
284
296
false
You can’t perform that action at this time.
0 commit comments