andlabs / andlabs/libui

Memory Management

Offen
#390 25 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
C
Sterne
10.9k
Forks
612
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi there,
I made a binding of libui to a garbage collected language, and have hit a problem. Currently all container controls destroy their children when they are destroyed. However, in garbage collected languages, this violates the principle of least surprise. You do normally not expect an object to become invalid as long as you have a reference to it. What's more, you can't even tell that the object has become invalid, but the problem here is the object becoming invalid in the first place.

My current solution for this is to remove all children from container controls before I destroy them, but this does not work for uiGrid, which does not have a function to remov children, and menus in their current form are even more of a special case.

I would wish for all container widgets to have a method to delete all of their children (without destroying them, of course), or at least a method to delete individual widgets, paired with a way to actually find them. Like, the uiBox control has no way to determine the number of children, but the uiTab control has... plus a solution for menus, that addresses this problem.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.