Re: gtk2 Segmentation faults



> According to a debugger, where is it crashing (load it up in ddd after
> compiling with -g)?  The code you present here looks really suspicious. 
> As was pointed out, declaring a variable after a function call is
> illegal in C.  Also note that GtkWidget *window is not a gtk statement
> at all.  It is a variable declaration, nothing more.  Should you try to
> use this variable without initializing it with gtk_window_new(), it will
> crash.  Since the GtkWidget *window line is not a gtk call or a function
> call of any kind, move the printf's down towards the part of the code
> where you actually create a new window and assign it to the pointer. 
> (Don't forget to initialize the gtk engine... it's gtk_init(argc,argv) I
> think.

Ok. I loaded that little snippet of code into the debugger and it crashes with that error message:

[...]

Program received signal SIGSEGV, Segmentation fault.
gdk_window_get_geometry (window=0x0, x=0x0, y=0x0, width=0x4067ef5c, height=0x4067ef60, depth=0x0) at gdkwindow-x11.c:2147
	in gdkwindow-x11.c
(gdb)

He want to search gdkwindow-x11.c in the current directory as it seems..

Sorry. I haven't much experiences with debugging.

*Kristian

  :... [snd.science] ...:
 ::
 :: http://www.korseby.net
 :: http://gsmp.sf.net
  :..........................:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]