Re: Segfault on exit




Okay, I'm going to add a little more detail here. The dialog box has
eleven spinners, one check box, two buttons and one three button radio
button set. I started experimenting with the window. First, I stripped
everything except the two buttons. That worked fine. I progressively added
in the spinners etc... It turns out that it is the radio buttons that are
giving me trouble. If I leave them out, no problems, if I put them back
in, core dump... 

Here is the block of code that generates them:

 button = gtk_radio_button_new_with_label (NULL, "Manhatten");
  gtk_signal_connect(GTK_OBJECT(button),
                     "clicked",
                     GTK_SIGNAL_FUNC(topo_click),
                     (gpointer)TOPO_MANHATTAN);
  gtk_box_pack_start (GTK_BOX (vbox2), button, TRUE, TRUE, 0);
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
  button = gtk_radio_button_new_with_label(group, "Torus");
   gtk_signal_connect(GTK_OBJECT(button),
                     "clicked",
                     GTK_SIGNAL_FUNC(topo_click),
                     (gpointer)TOPO_TORUS);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
   gtk_box_pack_start (GTK_BOX (vbox2), button, TRUE, TRUE, 0);
   button = gtk_radio_button_new_with_label(gtk_radio_button_group
(GTK_RADIO_BUTTON (button)),"Hypercube");
   gtk_signal_connect(GTK_OBJECT(button),
                      "clicked",
                      GTK_SIGNAL_FUNC(topo_click),
                      (gpointer)TOPO_HCUBE8);
   gtk_box_pack_start (GTK_BOX (vbox2), button, TRUE, TRUE, 0);



TOPO_MANHATTEN, TOPO_TORUS and TOPO_HCUBE8 are all #define integers. I
just coerce them into gpointers to pass them along.

Is there some BAD THING that I'm doing in there that I can't see?

Thanks,
Christopher 

On Mon, 25 Jun 2001, Black wrote:



Hello,
      I am kind of new to this gtk stuff, so please bear with me...

I am working with a fairly large program that uses a considerable number
of threads. The programmer previously in control of the code wrote a
little gtk thread that graphically displayed the state of the program.
That was off in its own thread, and it worked fine.

I decided that I needed to have a dialog box on start up that allowed me
to set a number of parameters without re-compiling. So, I wrote a little
bit of gtk code to provide this. The basic flow is now:

1) init some data structures
2) call gtk_init
3) build window
4) call gtk_main()
5) wait for gtk_main() to return (from Run or Cancel being clicked)
6) start spawning threads (including gtk thread which is optional)
7) end by calling exit(0); from one of the threads


Now, this does work. Sometimes. I am running simulations, and if I
increase the number of things I'm simulating (and thus the number of
data structures and threads), when I do the run, I get a Segfault. It core
dumps right on the exit() call which makes it hard to tell what exactly is
going on. However, the stack trace I get from gdb is:

#0  0xef046694 in t_splay () from /usr/lib/libc.so.1
#1  0xef046504 in t_delete () from /usr/lib/libc.so.1
#2  0xef0461d8 in realfree () from /usr/lib/libc.so.1
#3  0xef046944 in _free_unlocked () from /usr/lib/libc.so.1
#4  0xef046894 in free () from /usr/lib/libc.so.1
#5  0xef129ac4 in _XFreeDisplayStructure () from
/usr/openwin/lib/libX11.so.4
#6  0xef122b50 in XCloseDisplay () from /usr/openwin/lib/libX11.so.4
#7  0xef61f450 in gdk_exit_func () from /usr/local/lib/libgdk-1.2.so.0
#8  0xef018da8 in _exithandle () from /usr/lib/libc.so.1
#9  0xef0882e4 in exit () from /usr/lib/libc.so.1   

So, it looks like there is something from gtk that isn't being cleaned up,
but I can't tell what it is, or how to fix it. I've tried many different
variations. If I take out all gtk calls, it works fine. If I just leave
the gtk_init() in and no other gtk calls, it works fine. If I put the
status thread in, it works fine. But the second I add the dialog window
in, it fails (but only for a run of sufficent size). The dialog box only
consists of like ten spinners. If anyone has any idea what I am doing
wrong, I would really appreciate it.

-Christopher


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






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