Freeing gadgets question

BlitzMax Forums/MaxGUI Module/Freeing gadgets question

ima747(Posted 2010) [#1]
If I FreeGadget() on a window, does that properly free all the gadgets attached to the window as well? or do I have to manually free every gadget individually?


Grisu(Posted 2010) [#2]
As there are no other answers yet:
I would think that the garbage collector should free every gadget attached to a window by itself.


ima747(Posted 2010) [#3]
That was my theory, either that or the window should free it's children when it's freed. But I can't find an official note anywhere.


Zeke(Posted 2010) [#4]
yea.
from gadget cleanup code:
For Local tmpChild:TGadget = EachIn kids.Copy()
	tmpChild.CleanUp()
Next

so all kids are deleted when freegadget


ima747(Posted 2010) [#5]
aah, thank you for verification!


SebHoll(Posted 2010) [#6]
If I FreeGadget() on a window, does that properly free all the gadgets attached to the window as well?

Yep - so be careful of dangling pointers.