[gtk-server] Re: I can't get v1.2.2 to work

  • From: Mark Carter <mcturra2000@xxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Sun, 31 Oct 2004 18:45:18 +0000

Peter van Eerten wrote:
>This will not work since you forget to initialize GTK with gtk_init(NULL, 
>NULL). Your example below delivers a segfault with me also. Can you run the 
>GDB trace again with gtk_init(NULL, NULL) and gtk_window_new(0)??

My mistake. I think that

gtk_init(NULL, NULL)
really was input by me; I just left it off the transcript.

I have now recompiled the program to give some debugging information 
-ggdb. The relevant Makefile line is:
CFLAGS =        -ggdb -Wall -I/usr/include/gtk-1.2 
-I/usr/include/glib-1.2 -I/usr/lib/glib/include    -DHAVE_CONFIG_H

Something about line 451. argv[0] is (void *) 0x0
Is this likely to be wrong?

It's been years since I've messed around with C. Anyway, here's a 
transcript of my debugging session (sligthly edited):

mcarter@dali:~$ gdb --args gtk-server stdin log
*(gdb) b 451*
*(gdb) run*
Starting program: /usr/local/bin/gtk-server stdin log
*gtk_init(NULL, NULL)*

Breakpoint 1, Widget_Gtk (handle=0x807d3e0, name=0x8050f6b "gtk_window_new",
    amount=0x8050f91 "1", type=0x8050f7b "delete-event", counter=38,
    arg=0xbffff4a0, buffer=0x8081078 "ok") at gtk-server.c:451
451                     widget = (GtkWidget*)(*func)(arg[0]);
*(gdb) print func*
$1 = (GtkWidget *(*)()) 0x40631670 <gtk_window_new>
*(gdb) print arg*
$2 = (void **) 0xbffff4a0
*(gdb) print arg[0]*
$3 = (void *) 0x0
*(gdb) s*

Program received signal SIGSEGV, Segmentation fault.
0x407ee323 in g_type_fundamental () from /usr/lib/libgobject-2.0.so.0

If we're getting the same values for *arg[0], *then maybe the problem 
really lies in one of the GTK libraries. Half a moment! I seem to be 
linking to gtk-1.2. Maybe that's the error.
Curious, I think I made a daft attempt at installing GTK 1.2 earlier 
today. It was daft because I I think I had GTK 2 without realising.  So 
that could be the problem.

I'll report back.

Other related posts: