[gtkada] access check failed

Warren W. Gay VE3WWG ve3wwg at cogeco.ca
Mon Sep 6 05:34:26 CEST 2004


I just put the Status bar to work myself this week, so perhaps I
can help..

Matthias Teege wrote:

> Moin,
> 
> I'm playing with gtk ada and try to integrate some code borrowd from
> another gtkada project. The code push messages to the statusbar. It
> looks like that:
> 
> procedure call_statusbar (text : in string)
> is
>      my_id   : context_ID := Get_Context_ID(Window1.statusbar1,"Hallo");
>      message : message_ID;
> begin
>      message := Push(Window1.statusbar1,my_id,text);
> end call_statusbar;
...
> The code compiles but if I try to run it, it gives me
> 
> ./window1
> 
> (window1:5678): Gtk-WARNING **: Invalid input string
> *** NOTICE : WARNING:  there is no transaction in progress
> 
> raised CONSTRAINT_ERROR : window1_pkg.ads:142 access check failed
> 
> window1_pkg.ads:142 looks like that
> 
> ....
>       Label4 : Gtk_Label;
>       Statusbar1 : Gtk_Statusbar;
>       Connection : Connection_Access;
>    end record;
>    type Window1_Access is access all Window1_Record'Class;
> 
>    procedure Gtk_New (Window1 : out Window1_Access);
>    procedure Initialize (Window1 : access Window1_Record'Class);
> 
> L142->   Window1 : Window1_Access;
> end Window1_Pkg;
> 
> What is the "access check" and why does it fail?

The "access check" is probably from your Window1.Statusbar1
being the value null. Check that you've actually done
a Gtk_New() on it. I suspect that it is null (the type is
an access type, which will initialize to null by default).

The next problem is that the documentation says that your paramter
supplied as "text" should be a UTF8_String. So you should probably
change your code to something like (changes in uppercase):

procedure call_statusbar (text : in string)
 > is
 >      USE GLIB.CONVERT;
 >      my_id   : context_ID := Get_Context_ID(Window1.statusbar1,"Hallo");
 >      message : message_ID;
 > begin
 >      message := Push(Window1.statusbar1,my_id,LOCALE_TO_UTF8(text));
 > end call_statusbar;

Hope that helps, Warren.
-- 
Warren W. Gay VE3WWG
http://home.cogeco.ca/~ve3wwg



More information about the gtkada mailing list