Re: gtk2 Segmentation faults



On Sun, 2002-03-17 at 15:00, Kristian Peters wrote:
> Owen Taylor <otaylor redhat com> wrote:
> > Is your system Red Hat 7.2 in other ways?
> 
> No. I applied updates from errata only.
> 
> > Porbably something to do with config files or the set of files in your packages. Maybe you could try the i386.rpm 
> > from ftp.gtk.org; they are built against 7.2 with almost exactly the SRPMs as the ones in rawhide. (They
> > have debugging information, however.)
> > 
> >  * As Sven says, is anything printed on the console?
> >  * If you do a backtrace, where is it crashing?
> 

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.

Michael



> $ ./test 
> Segmentation fault
> 
> ^^^ immediately after the first gtk-command. 
> 
> #include <gtk/gtk.h>
> 
>  int main( int   argc,
>            char *argv[] )
>  {
>      printf("1\n");
>      GtkWidget *window;
>      printf("2\n");
> [...]
> 
> reveals:
> 
> $ ./test 
> 1 
> Segmentation fault
> 
> No matter what gtk-statement I use.
> 
> > If you are using Xft, the problem may be a bug in XFree86-4.1; upgrading to 4.2 is really necessary to use
> > Xft fonts.
> 
> No I'm not using Xft fonts.
> 
> I'll download the packages from gtk.org. But I have a slow modem connection. ;-(
> 
> *Kristian
> 
>   :... [snd.science] ...:
>  ::
>  :: http://www.korseby.net
>  :: http://gsmp.sf.net
>   :..........................:
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
-- 
Public key available from http://students.cs.byu.edu/~torriem


Attachment: signature.asc
Description: This is a digitally signed message part



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