From b72f41264d96f6cd9333badad82f978ecdc48fc2 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Fri, 15 Jul 2016 22:20:30 +1000 Subject: Groups and Widgets should now keep track of themselves properly, also all named access types removed --- src/fltk_binding/fltk-text_buffers.adb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/fltk_binding/fltk-text_buffers.adb') diff --git a/src/fltk_binding/fltk-text_buffers.adb b/src/fltk_binding/fltk-text_buffers.adb index 12a6a73..52f475d 100644 --- a/src/fltk_binding/fltk-text_buffers.adb +++ b/src/fltk_binding/fltk-text_buffers.adb @@ -23,8 +23,10 @@ package body FLTK.Text_Buffers is procedure Finalize (This : in out Text_Buffer) is begin - if (This.Void_Ptr /= System.Null_Address) then - free_fl_text_buffer (This.Void_Ptr); + if This.Void_Ptr /= System.Null_Address then + if This in Text_Buffer then + free_fl_text_buffer (This.Void_Ptr); + end if; end if; end Finalize; @@ -35,14 +37,12 @@ package body FLTK.Text_Buffers is (Requested_Size : in Natural := 0; Preferred_Gap_Size : in Natural := 1024) return Text_Buffer is - - VP : System.Address; - begin - VP := new_fl_text_buffer + return This : Text_Buffer do + This.Void_Ptr := new_fl_text_buffer (Interfaces.C.int (Requested_Size), Interfaces.C.int (Preferred_Gap_Size)); - return (Ada.Finalization.Limited_Controlled with Void_Ptr => VP); + end return; end Create; -- cgit