libui.cr
libui.cr copied to clipboard
control_destroy can't accept any actual controls, because of type
I am trying to delete a box, with all its children.
I believe there are two possible ways to do this, but I haven't manage to make work any of them.
I can use box_delete
on the parent, with the index to delete. This works, but does cause memory leaks, because the controls are not actually destroyed, only removed from the UI.
What I need to use is control_destroy
. However, because of how Crystal type
works, there doesn't seem to be any way to convert a, for example, UI::Box
into a UI::Control
. Therefore, control_destroy
isn't actually usable in any way I can find.