Killing Widgets: simple source



> 
> > 
> > I use the destroy widget method. specifically, gtk_exit().
> > It works okey when called from a widget such as a menu item,
> > but core dumps when I call it via the "destroy" method.
> 
> 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) {

	gtk_exit();
}

int main (int argc, char *argv[]) {

	GtkWidget *win;

	gtk_init(argc, argv);

	win= gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_container_border_width(GTK_CONTAINER(win), 5);
	gtk_signal_connect (GTK_OBJECT(win),
				"destroy",
				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 you add a button, or a menuitem and connect it to the same
callback function it exits normally.

I am using gtk+-971201, with the fvwm window manager. 

I don't think this is a bug in gtk since the same program above
will run properly on a friends box.

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.

Any further questions, just ask?

> > > 2.  Also how to access widgets embedded in another
> > > widget.  Right now I am using a structure for each
> > > window type that contains pointers to all the widgets.
> > > Is access to the widgets builtin to gtk so that I
> > > don't need to do this?
> > 
> > I would like to know this too?
> 
> take a look at gtk_container_children() it builds up a
> linked list of child pointers for you, and if you one of
> these children is GTK_IS_CONTAINER(child) == TRUE, you can
> use gtk_container_children(child) on this child as well.
> 
> > 
> > 
> 
> ---
> ciaoTJ
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 
> 



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