Topic was automatically imported from the old Question2Answer platform.
Asked By
Robotex
I often have a situation when bot shoot to another bot and then died when bullet is flied still. But then, after bot was removed from scene by queue_free, bullet can hit some bot and try to access pointer that points to died bot (each bullet has pointer to shooter).
So, is it possible to check that pointer is not valid anymore?
There is a function in GDScript called, is_queued_for_deletion().
Check if there is a GDNative equivalent function.
nightrobin | 2021-02-12 15:39
No, this function will not work in this case, because object can be deleted a long time ago but something still has pointer to it that is not valid. So, calling is_queued_for_deleting will cause the crash.