summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-buttons-light.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/fltk-widgets-buttons-light.adb')
-rw-r--r--src/fltk-widgets-buttons-light.adb13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/fltk-widgets-buttons-light.adb b/src/fltk-widgets-buttons-light.adb
index 88fa147..e3b1cfd 100644
--- a/src/fltk-widgets-buttons-light.adb
+++ b/src/fltk-widgets-buttons-light.adb
@@ -35,6 +35,9 @@ package body FLTK.Widgets.Buttons.Light is
procedure Draw_Hook
(U : in System.Address)
is
+ package Light_Button_Convert is new
+ System.Address_To_Access_Conversions (Light_Button'Class);
+
Ada_Light_Button : access Light_Button'Class :=
Light_Button_Convert.To_Pointer (U);
begin
@@ -56,12 +59,12 @@ package body FLTK.Widgets.Buttons.Light is
procedure Finalize
(This : in out Light_Button) is
begin
- Finalize (Button (This));
- if (This.Void_Ptr /= System.Null_Address) then
- if This in Light_Button then
- free_fl_light_button (This.Void_Ptr);
- end if;
+ if This in Light_Button and then
+ This.Void_Ptr /= System.Null_Address
+ then
+ free_fl_light_button (This.Void_Ptr);
end if;
+ Finalize (Button (This));
end Finalize;