summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-boxes.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/fltk-widgets-boxes.adb')
-rw-r--r--src/fltk-widgets-boxes.adb12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/fltk-widgets-boxes.adb b/src/fltk-widgets-boxes.adb
index 2efc591..1c8fa5b 100644
--- a/src/fltk-widgets-boxes.adb
+++ b/src/fltk-widgets-boxes.adb
@@ -35,6 +35,8 @@ package body FLTK.Widgets.Boxes is
procedure Draw_Hook
(U : in System.Address)
is
+ package Box_Convert is new System.Address_To_Access_Conversions (Box'Class);
+
Ada_Box : access Box'Class :=
Box_Convert.To_Pointer (U);
begin
@@ -56,12 +58,12 @@ package body FLTK.Widgets.Boxes is
procedure Finalize
(This : in out Box) is
begin
- Finalize (Widget (This));
- if (This.Void_Ptr /= System.Null_Address) then
- if This in Box then
- free_fl_box (This.Void_Ptr);
- end if;
+ if This in Box and then
+ This.Void_Ptr /= System.Null_Address
+ then
+ free_fl_box (This.Void_Ptr);
end if;
+ Finalize (Widget (This));
end Finalize;