summaryrefslogtreecommitdiff
path: root/src/fltk-widgets-groups.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/fltk-widgets-groups.adb')
-rw-r--r--src/fltk-widgets-groups.adb12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/fltk-widgets-groups.adb b/src/fltk-widgets-groups.adb
index 9bcb78f..669e2a8 100644
--- a/src/fltk-widgets-groups.adb
+++ b/src/fltk-widgets-groups.adb
@@ -73,6 +73,8 @@ package body FLTK.Widgets.Groups is
procedure Draw_Hook
(U : in System.Address)
is
+ package Group_Convert is new System.Address_To_Access_Conversions (Group'Class);
+
Ada_Group : access Group'Class :=
Group_Convert.To_Pointer (U);
begin
@@ -94,13 +96,13 @@ package body FLTK.Widgets.Groups is
procedure Finalize
(This : in out Group) is
begin
- Finalize (Widget (This));
- if This.Void_Ptr /= System.Null_Address then
+ if This in Group and then
+ This.Void_Ptr /= System.Null_Address
+ then
This.Clear;
- if This in Group then
- free_fl_group (This.Void_Ptr);
- end if;
+ free_fl_group (This.Void_Ptr);
end if;
+ Finalize (Widget (This));
end Finalize;