summaryrefslogtreecommitdiff
path: root/src/fltk-tooltips.adb
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2025-01-14 01:54:17 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2025-01-14 01:54:17 +1300
commit1ba99737bca1136170f04b3a46659deb042e3fcd (patch)
tree9b42991aa5aed8c76abcd1bf5ba980e249f0de28 /src/fltk-tooltips.adb
parent88ca2ea14ba6651404cd4ea347ac8f06afdd0558 (diff)
Fixed a number of issues with getting the Ada wrapper back given a C++ widget pointer
Diffstat (limited to 'src/fltk-tooltips.adb')
-rw-r--r--src/fltk-tooltips.adb17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/fltk-tooltips.adb b/src/fltk-tooltips.adb
index 84e4160..ccdb649 100644
--- a/src/fltk-tooltips.adb
+++ b/src/fltk-tooltips.adb
@@ -6,6 +6,7 @@
with
+ Ada.Assertions,
Interfaces.C,
System.Address_To_Access_Conversions;
@@ -17,6 +18,11 @@ use type
package body FLTK.Tooltips is
+ package Chk renames Ada.Assertions;
+
+
+
+
------------------------
-- Functions From C --
------------------------
@@ -174,13 +180,16 @@ package body FLTK.Tooltips is
return access FLTK.Widgets.Widget'Class
is
Widget_Ptr : Storage.Integer_Address := fl_tooltip_get_current;
+ Actual_Widget : access FLTK.Widgets.Widget'Class;
begin
if Widget_Ptr /= Null_Pointer then
- return Widget_Convert.To_Pointer
- (Storage.To_Address (fl_widget_get_user_data (Widget_Ptr)));
- else
- return null;
+ Widget_Ptr := fl_widget_get_user_data (Widget_Ptr);
+ pragma Assert (Widget_Ptr /= Null_Pointer);
+ Actual_Widget := Widget_Convert.To_Pointer (Storage.To_Address (Widget_Ptr));
end if;
+ return Actual_Widget;
+ exception
+ when Chk.Assertion_Error => raise Internal_FLTK_Error;
end Get_Target;