Strange error in button callback.




Ok, this one ought to be good.  I'm getting a segfault coming OUT of a
button callback. When I run it through gdb I get that the program recieved
a segfault at:
0x6f672f65 in ?? ()

I just this address back if I do a backtrace.

Any ideas?

I know it's getting out of the function because I have a print and a
flush at the end of the function that I get back.

Here is the function:

void remove_stuff(GtkWidget *widget, gpointer data)
{
  gchar *name[0] = {""};
  GList *li, *holdit = NULL;
  gint done = 0;

  if (selected == 1) {
    selected = 0;
    gtk_clist_clear(GTK_CLIST(adclist));
    gtk_clist_freeze(GTK_CLIST(adclist));
    for (li = g_list_nth(dtemp, 1); li != NULL; li = g_list_next(li)) {
      if (!strcmp(dselected, (name[0] = (gchar *)li->data)) && !done) {
        holdit = li;
        done = 1;
      }
      else gtk_clist_append(GTK_CLIST(adclist), name);
    }
    if (holdit) {
      dtemp = g_list_remove_link(dtemp, holdit);
      g_list_free(holdit);
    }
    gtk_clist_thaw(GTK_CLIST(adclist));
  }
g_print("hi\n"); fflush(stdout);
  if (selected == 2) {
    selected = 0;
    gtk_clist_clear(GTK_CLIST(afclist));
    gtk_clist_freeze(GTK_CLIST(afclist));
    for (li = g_list_first(ftemp); li != NULL; li = g_list_next(li)) {
      if (!strcmp(fselected, (name[0] = (gchar *)li->data)) && !done) {
        holdit = li;
        done = 1;
      }
      else gtk_clist_append(GTK_CLIST(afclist), name);
    }
    if (holdit) {
      ftemp = g_list_remove_link(ftemp, holdit);
      g_list_free(holdit);
    }
    gtk_clist_thaw(GTK_CLIST(afclist));
  }
g_print("hi\n"); fflush(stdout);
}

Here is what I do to set up the callback:

  button = gtk_button_new();
  gtk_signal_connect(GTK_OBJECT(button), "clicked",
                     GTK_SIGNAL_FUNC(remove_stuff), NULL);

I get this when I run gdb (I set a break at the end of the function):

(gdb) break file_sel.c:82
Breakpoint 1 at 0x804d87c: file file_sel.c, line 82.
(gdb) run
Starting program: /home/govind/cs/gnome/gBackGround_applet 
hi
hi

Breakpoint 1, remove_stuff (widget=0x80f2690, data=0x0)
    at file_sel.c:82
82      }
(gdb) step
0x4029c65d in gtk_marshal_NONE__NONE ()
(gdb) step
Single stepping until exit from function gtk_marshal_NONE__NONE, 
which has no line number information.
Cannot insert breakpoint 0:
Temporarily disabling shared library breakpoints:
0 

Program received signal SIGSEGV, Segmentation fault.
0x6f672f65 in ?? ()
(gdb) quit
The program is running.  Exit anyway? (y or n) y

Any help would be appreciated.

                                        -Govind Salinas



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