[gtkada] base_widget example fails Assert

Stephen Leake stephen_leake at acm.org
Wed Apr 10 03:45:58 CEST 2002


I'm using GtkAda 1.3.12 on Windows 98 (I know, I should move to
Windows NT).

When I compile GtkAda-1.3.12/examples/base_widget/ with -gnata (enable
assertions), I get an assert failure:

bash $ cd c:/Gnu/GtkAda-1.3.12/examples/base_widget/
bash $ ./main

raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : Handlers for this signal should return a value.
bash $ 

This is from my_widget.adb:235 :

      --  Set up the appropriate callbacks to redraw, ...
      Draw_Cb.Connect (Widget, "expose_event",
                       Draw_Cb.To_Marshaller (Draw_Target'Access), True);


The specific assert is at gtk-handlers.adb:918 :

         pragma Assert
           (Argument_Type (Get_Type (Widget), Name, -1) = Gtk_Type_None,
            "Handlers for this signal should return a value.");

At this point in the code, the handler is of type
Marshallers.Marshaller, and Marshallers is an instantiation of
Gtk.Marshallers.Void_Marshallers, which does not return a value. So
the Assert is checking to see if that is what the signal expects.

So, apparently the "expose_event" signal expects a return value, but
the handler provided by this example does not return one.

In gtk-widget.ads, "expose_event" is defined as:

   --  - "expose_event"
   --    function Handler (Widget : access Gtk_Widget_Record'Class;
   --                      Event  : Gdk.Event.Gdk_Event_Expose)
   --                     return Boolean;

So apparently it should return a value.

This is not fixed in GtkAda 2.0.0 - at least, the corresponding code
in my_widget.adb has not changed.

I suggest part of the release process for GtkAda be compiling the
examples with -gnata :). I haven't checked the rest of the examples
yet.

-- 
-- Stephe





More information about the gtkada mailing list