From df843c7fe48f33d25981d03975e670a3e7159031 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sun, 7 May 2017 12:04:33 +1000 Subject: Further code cleanup --- src/fltk-widgets-boxes.adb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/fltk-widgets-boxes.adb') 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; -- cgit