Re: [gtk-list] Killing Widgets: simple source



On Tue, 23 Dec 1997, INTERLOG ACCOUNT wrote:

> > this shouldn't happen, and i have never seen this so far,
> > could you provide a simple test case please?
> > 
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include "gtk/gtk.h"
> 
> void destroy (Widget *w, gpointer g) {
		^^^^^^ this has to be `GtkWidget'
> 
> 	gtk_exit();
		^^ missing argument, insert `0'
> }
> 
> int main (int argc, char *argv[]) {
> 
> 	GtkWidget *win;
> 
> 	gtk_init(argc, argv);
		^^^^^^^^^^^^
		argc and argv have to be preceeded by `&', so that
		only the adress is passed
> 
> 	win= gtk_window_new(GTK_WINDOW_TOPLEVEL);
> 	gtk_container_border_width(GTK_CONTAINER(win), 5);
> 	gtk_signal_connect (GTK_OBJECT(win),
> 				"destroy",
				^^^^^^^^^
				this doesn't work, i changed it to
				"delete_event"
> 				GTK_SIGNAL_FUNC(destroy),
> 				NULL );
> 	gtk_widget_show(win);
> 	gtk_main();
> 
> 	return 0;
> }
> 
> The above is the simplest program I could write that exhibited
> the core dumping when destroy was called by the upper left menu
> on the window.

i wonder, how you could get your example to work, but with the
above mentioned modification, i couldn't reproduce your
core dump.

> For the record, I am using linux-2.0.31 kernel, Xfree svga server vs. 3.1
> My hardware is a pentium-120, 32 M memory, 2 G ide quantum drive.
> My X settings are straight from the x86config program.

ok, please tell your gcc command line flags and compile
the program with debug information and run it in gdb, like so:

birgrave:bash<~>$ gcc test.c -g -lgtk -lgdk -lglib -lm
birgrave:bash<~>$ gdb ./a.out
(gdb) r
Starting program: ./a.out 

Program received signal SIGINT, Interrupt.
0x4011671c in __select (nd=0, in=0x0, out=0x4009d560, ex=0x806a270, 
    tv=0x400a3314)
(gdb) bt
#0  0x4011671c in __select (nd=0, in=0x0, out=0x4009d560, ex=0x806a270, 
    tv=0x400a3314)
#1  0x40133c88 in __DTOR_END__ ()
#2  0x400843a5 in gdk_event_get () at gdk.c:727
#3  0x400377f7 in gtk_main_iteration () at gtkmain.c:270
#4  0x400376f9 in gtk_main () at gtkmain.c:206
#5  0x8048782 in main (argc=1, argv=0xbffff814) at test.c:24
#6  0x804868e in ___crt_dummy__ ()

so we can get a full stack trace and understand your problem.

> 
> Any further questions, just ask?
> 

---
ciaoTJ



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