From 1ba99737bca1136170f04b3a46659deb042e3fcd Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 14 Jan 2025 01:54:17 +1300 Subject: Fixed a number of issues with getting the Ada wrapper back given a C++ widget pointer --- src/fltk-widgets-groups-windows-double-cairo.adb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/fltk-widgets-groups-windows-double-cairo.adb') diff --git a/src/fltk-widgets-groups-windows-double-cairo.adb b/src/fltk-widgets-groups-windows-double-cairo.adb index 75cf50a..eedcbd1 100644 --- a/src/fltk-widgets-groups-windows-double-cairo.adb +++ b/src/fltk-widgets-groups-windows-double-cairo.adb @@ -6,6 +6,7 @@ with + Ada.Assertions, Interfaces.C, System.Address_To_Access_Conversions; @@ -13,6 +14,11 @@ with package body FLTK.Widgets.Groups.Windows.Double.Cairo is + package Chk renames Ada.Assertions; + + + + ------------------------ -- Functions From C -- ------------------------ @@ -74,9 +80,12 @@ package body FLTK.Widgets.Groups.Windows.Double.Cairo is Ada_Object : access Cairo_Window'Class := Cairo_Convert.To_Pointer (Ada_Addr); begin + pragma Assert (Ada_Object /= null); if Ada_Object.My_Func /= null then Ada_Object.My_Func (Cairo_Window (Ada_Object.all), Storage.To_Address (Cairo_Addr)); end if; + exception + when Chk.Assertion_Error => raise Internal_FLTK_Error; end Cairo_Draw_Hook; -- cgit