In my app, I have a Control structure, and a list of controls associated with a view. Then I have a different structure for each gadget, and all those structures extend to Control. So it looks like something like that:
Code: Select all
Structure _Control
EndStructure
Structure _Button Extends _Control
EndStructure
Structure _Label Extends _Control
EndStructure
Structure _View
List *controls._Control()
EndStructure
Define my_view._View
AddElement(my_view\controls())
my_view\controls() = AllocateStructure(_Button)
Define *button._Button = my_view\controls()
; Do something with the button here.
; When closing the view, I free all the associated controls.
ForEach my_view\controls()
FreeStructure(my_view\controls())
Next
ClearList(my_view\controls())
I've spent months with that code without any problem, but since a few days, I now have a crash on FreeStructure(), and this crash does not always happen, even though I do exactly the same things before the crash happens. So I know I'm throwing a message in a bottle here, but in case I missed something obvious or some people had weird problems with that function, or if you have any idea about what mistakes I potentially did, I would be happy to hear from you!
(Windows 11 64bits, PB 6.12, Purifier ON, ASM backend)