We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2d4861 commit 29f58ffCopy full SHA for 29f58ff
godot-core/src/obj/script.rs
@@ -360,9 +360,11 @@ where
360
return false;
361
}
362
363
- let object_script: Gd<Script> = object_script_variant.to();
364
-
365
- if object_script.upcast_ref::<Script>().__object_ptr() != script.upcast_ref().__object_ptr() {
+ if object_script_variant
+ .object_id()
+ .map(|instance_id| instance_id != script.instance_id())
366
+ .unwrap_or(true)
367
+ {
368
369
370
@@ -371,6 +373,8 @@ where
371
373
};
372
374
375
let get_instance_fn = sys::interface_fn!(object_get_script_instance);
376
+
377
+ // SAFETY: object and language are alive and their sys pointers are valid
378
let instance = unsafe { get_instance_fn(object.obj_sys(), language.obj_sys()) };
379
380
!instance.is_null()
0 commit comments