Re: I think I found a freak bug on GTK+-1.3.15



On Tue, 2002-02-26 at 14:47, Ramsés Morales wrote:
> If I compile an app with this two lines:
> 
> GtkTreeViewColumn *ca;
> GtkTreeViewColumn *cb;
> 
> When I run the app, I get a Segmentation Fault. *cb isn't used on the
> code.
> 
> If I compile the app after comenting:
> 
> GtkTreeViewColumn *ca;
> /*GtkTreeViewColumn *cb;*/
> 
> ...it runs nicely.
> 
> This is wierd.

This type of thing is very likely indicative of some memory corruption
in your code.  It's unlikely to be in gtk (but could be).  Just the fact
that removing the second pointer declaration makes it work indicates
that it's your code that's messing up somewhere.  Just declaring a
pointer doesn't do any object initialization (ie gtk_tree_view_new type
stuff).  What it does do is change your stack layout slightly such that
whatever memory corruption you're doing won't cause an immediate crash
when you remove that unused variable.  Adding it back in changes offsets
just slightly so that something important on the stack is overwritten.

Pointer errors always maifest themselves in this type of manner.  Very
frustrating.  Good luck.  You'll want to run your code through DDD
debugger.  It has some very powerful facilities for viewing your
variables etc.  You can then watch what happens when the offending line
is executed.  Also you can load the core file into the debugger after
the fact and see what line triggered the core dump, see the variables,
etc.  Should help you establish what's happening.  (DDD is run by the
command ddd.  It's downloadable from the internet too -- see
freshmeat.net)

Michael


> 
> 
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-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]