[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fwd: Order of _free calls on objects perhaps broken
[Thread Prev] | [Thread Next]
- Subject: Fwd: Order of _free calls on objects perhaps broken
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Sun, 12 Jan 2025 14:27:47 -0800
- To: GambasList <user@xxxxxxxxxxxxxxxxxxxxxx>
On 1/12/25 11:23, Benoît Minisini wrote:
I understand that _free is called upon release of an object. It is the order in which they are released that seems to be at issue.Le 12/01/2025 à 19:43, Brian G a écrit :When gambas exits a program it releases objects by calling the _free() function in each object if present.No, it's the contrary: '_free()' is called when the object is released. '_free()' does not release anything.This method is not starting from the main application downward, but appears to go linearly through an internal list of objects calling the _free() as it goes along.At the end of the event loop, all global static objects of each class are dereferenced.If there is still non-free objects after that process, that means you have circular references. Gambas can't solve them, it just emits a warning in that case before quitting.You must not create circular references in your code.It's a bug, but normally in your code, not in Gambas - unless something inside Gambas native code forgets to release a reference.Regards,
if i have an object a that contains an instance of object b and c, b and c get reported as circular in my case as they seem to be getting release somehow before a is released. But if i explicitly call A._free() which then releases b and c then there is no error. In some cases actual structures are being reported as circular references...
Does that make sense ? ~~~~ Brian
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature