aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-04-13 20:43:03 +1200
committerJedidiah Barber <contact@jedbarber.id.au>2025-04-13 20:43:03 +1200
commit7c454d924cf2e34adaf84012d5e3249d81d200e8 (patch)
treeb8c3507973f2090648b6c2a034a88d8e9e3e19f2
parentd80d210d6b1418ba3e773186337c5da7ea169c4e (diff)
Extra_Final now checks appropriately whether Needs_Dealloc
-rw-r--r--body/fltk-widgets-groups.adb4
-rw-r--r--body/fltk-widgets.adb9
2 files changed, 9 insertions, 4 deletions
diff --git a/body/fltk-widgets-groups.adb b/body/fltk-widgets-groups.adb
index 4c30dfb..d6b51d4 100644
--- a/body/fltk-widgets-groups.adb
+++ b/body/fltk-widgets-groups.adb
@@ -217,7 +217,9 @@ package body FLTK.Widgets.Groups is
procedure Extra_Final
(This : in out Group) is
begin
- This.Clear;
+ if This.Needs_Dealloc then
+ This.Clear;
+ end if;
Extra_Final (Widget (This));
end Extra_Final;
diff --git a/body/fltk-widgets.adb b/body/fltk-widgets.adb
index d446a93..acb87f0 100644
--- a/body/fltk-widgets.adb
+++ b/body/fltk-widgets.adb
@@ -637,10 +637,13 @@ package body FLTK.Widgets is
procedure Extra_Final
(This : in out Widget)
is
- Maybe_Parent : constant access FLTK.Widgets.Groups.Group'Class := This.Parent;
+ Maybe_Parent : access FLTK.Widgets.Groups.Group'Class;
begin
- if Maybe_Parent /= null then
- Maybe_Parent.Remove (This);
+ if This.Needs_Dealloc then
+ Maybe_Parent := This.Parent;
+ if Maybe_Parent /= null then
+ Maybe_Parent.Remove (This);
+ end if;
end if;
end Extra_Final;