summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-menus-menu_buttons.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/fltk-widgets-menus-menu_buttons.adb')
-rw-r--r--src/fltk-widgets-menus-menu_buttons.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb
index 4fedc08..b174db8 100644
--- a/src/fltk-widgets-menus-menu_buttons.adb
+++ b/src/fltk-widgets-menus-menu_buttons.adb
@@ -64,10 +64,11 @@ package body FLTK.Widgets.Menus.Menu_Buttons is
procedure Finalize
(This : in out Menu_Button) is
begin
- if This in Menu_Button and then
- This.Void_Ptr /= System.Null_Address
+ if This.Void_Ptr /= System.Null_Address and then
+ This in Menu_Button'Class
then
free_fl_menu_button (This.Void_Ptr);
+ This.Void_Ptr := System.Null_Address;
end if;
Finalize (Menu (This));
end Finalize;