Is there an easy way to guarantee Delete() will be called for a global object at the end of the program?
I've got a global object that logs some stuff upon it's deletion. Sometimes it might be deleted before the program ends, although it will usually last the life of the program.
Judging from the logs, it seems Delete() is never called.
I tried doing: OnEnd GCCollect
but that didn't work either. My guess was that was because the object hadn't been nullified yet. Nullifying the object and then calling GCCollect did work...but it's a clunky workaround. I have to specifically write a function that nulls out all of the global objects and then calls GCCollect - and then feed that function to OnEnd.
Is there any way to guarantee Delete() is called when the object goes out of scope (and it's a global object)?
I've got a global object that logs some stuff upon it's deletion. Sometimes it might be deleted before the program ends, although it will usually last the life of the program.
Judging from the logs, it seems Delete() is never called.
I tried doing: OnEnd GCCollect
but that didn't work either. My guess was that was because the object hadn't been nullified yet. Nullifying the object and then calling GCCollect did work...but it's a clunky workaround. I have to specifically write a function that nulls out all of the global objects and then calls GCCollect - and then feed that function to OnEnd.
Is there any way to guarantee Delete() is called when the object goes out of scope (and it's a global object)?