File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -354,15 +354,15 @@ where
354
354
O : Inherits < Object > ,
355
355
S : Inherits < Script > + IScriptExtension + super :: Bounds < Declarer = super :: bounds:: DeclUser > ,
356
356
{
357
+
357
358
let object_script_variant = object. upcast_ref ( ) . get_script ( ) ;
358
359
359
360
if object_script_variant. is_nil ( ) {
360
361
return false ;
361
362
}
362
363
363
- let object_script: Gd < Script > = object_script_variant. to ( ) ;
364
364
365
- if object_script . upcast_ref :: < Script > ( ) . __object_ptr ( ) != script. upcast_ref ( ) . __object_ptr ( ) {
365
+ if object_script_variant . object_id ( ) . map ( |instance_id| instance_id != script. instance_id ( ) ) . unwrap_or ( true ) {
366
366
return false ;
367
367
}
368
368
@@ -371,6 +371,8 @@ where
371
371
} ;
372
372
373
373
let get_instance_fn = sys:: interface_fn!( object_get_script_instance) ;
374
+
375
+ // SAFETY: object and language are alive and their sys pointers are valid
374
376
let instance = unsafe { get_instance_fn ( object. obj_sys ( ) , language. obj_sys ( ) ) } ;
375
377
376
378
!instance. is_null ( )
You can’t perform that action at this time.
0 commit comments