From 7c454d924cf2e34adaf84012d5e3249d81d200e8 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sun, 13 Apr 2025 20:43:03 +1200 Subject: Extra_Final now checks appropriately whether Needs_Dealloc --- body/fltk-widgets.adb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'body/fltk-widgets.adb') 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; -- cgit