RE: strange Seg fault
- From: "David L. Cooper II" <cooperdl worldnet att net>
- To: "ztoon" <ztoonifik netcourrier com>, <gtk-list gnome org>
- Subject: RE: strange Seg fault
- Date: Tue, 25 Jun 2002 08:14:35 -0400
I'm not sure if this will help, but I'll tell you anyway.
I had a similar problem recently with a program I was writing. I found the
problem to be caused by a call to a function with too few parameters. The
prototype for the function indicated it required 5 parameters but the actual
function call required 6. The compiler didn't pick up on this.
If I had a printf statement in my code anywhere before this function call,
the program ran fine. If I removed the printf, the program would crash. The
point is that the problem had nothing to do with the printf, even though it
seemed to.
I'm sure you'll find the problem.
Regards,
David
> -----Original Message-----
> From: gtk-list-admin gnome org [mailto:gtk-list-admin gnome org]On
> Behalf Of ztoon
> Sent: Sunday, June 23, 2002 1:43 PM
> To: gtk-list gnome org
> Subject: strange Seg fault
>
>
> First, you must know that this following code works perfectly,
> this is a clist row selection callback. I use it for testing. But
> there is a problem (yes...) the *y[] var isn't used, but if I
> delete it from the code, then I get a segmentation fault when
> executing this code. (very very strange, it seg fault as well
> after rebooting)
>
> But I found another relation, if I delete the sprintf function
> and the *y[] var, then there is no more seg fault... So I deduce
> that sprintf func without *y[] unused var makes a seg fault.
>
> but I need to use sprintf func (cause I haven't itoa() func) and
> I don't want this *y[] ghost var in my project... does somebody
> can find where could there be a problem.. thnx
>
> gboolean Callback_RowSelect(GtkWidget *w, gint lig, gint col,
> GdkEvent *ev, gpointer d)
> {
> gchar *y[3];
> gchar *t[3];
> gint x=0;
>
> GtkWidget *dList = gtk_object_get_data(GTK_OBJECT(EditWin),"pList");
>
> gtk_clist_clear(GTK_CLIST(dList));
>
> while(MyStruct[x].pNum)
> {
> sprintf(t[0],"%i",MyStruct[x].pNum); //converts a
> gint into gchar
> t[1]=MyStruct[x].pName;
> t[2]=MyStruct[x].pPos;
>
> gtk_clist_append(GTK_CLIST(dList),t);
> x++;
> }
> return TRUE;
> }
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]