[gtkada] Segmentation fault with Button for Keyboard.

Dmitry A. Kazakov mailbox at dmitry-kazakov.de
Sat Jul 4 13:27:26 CEST 2009


On Sat, 4 Jul 2009 18:46:57 +0800, you wrote:

> I am trying to create a Button to go in a Table and keep a
> record of where it is in that table.
> It all worked yesterday with Gtk.Button.Gtk_Button
> (Speller.jpg) but even one button won't compile today.
> 
> The debugger gives me a message about a segmentation fault
> but I can't see why. It seems to occur at the very start of
> the program where there is nothing done that can be wrong.
> 
> All assistance appreciated.

Move the call to Gtk.Main.Init above widget creation calls.

Other problems:

Add Show (Key_Window);
Add -mwindows key to the linker options of the project

Note that when Gtk gives you error messages. These messages, especially of
the critical level, should be paid attention first.

P.S. If you have troubles tracking down Glib messages you can use GtkAda
visual tracing from

   http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm

for example, the following will pop up a trace window upon a Glib error in
GObject with call stack back trace:

with Gtk.Main.Router.GNAT_Stack;
with GLib.Messages;
   ...
begin
   Gtk.Main.Init;
   Gtk.Main.Router.Init;
   Gtk.Main.Router.GNAT_Stack.Set_Log_Trace
   (  "Gtk", GLib.Messages.Log_Level_Flags'Last
   );
   Gtk.Main.Router.GNAT_Stack.Set_Log_Trace ("GLib-GObject");
   ...

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



More information about the gtkada mailing list