Re: [gtk-list] Re: grabs, gdb and GTK+



> Paul Barton-Davis <pbd@Op.Net> writes:
> > once again, i ask the powers-that-be to consider changing the
> > behaviour of certain widgets that take action on a button press
> > event. their application almost always hold a server grab at that
> > point, which means that if you want to use gdb to debug a function
> > executed as part of the button press handler(s), you are *hosed* - you

>  a) This is not a server grab but a pointer grab. You probably

I presume the situation is something like, pressing OK on a file selection
dialog, followed by e.g. a SIGSEGV during the OK button's callback?

For debugging, the following may help:

	file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(w));
	file = g_strdup(file);
	gtk_widget_destroy(w);
#ifdef DEBUG
	while(gtk_events_pending()) gtk_main_iteration();
#endif
	[proceed to generate SIGSEGV :-]

This way, the dialog box has actually been removed (along with any grabs,
of course), before the signal is generated.

Alternatively, you could try installing a signal handler:

static void oops(int sig)
{
	printf("SIGNAL %d\n", sig);
	gdk_pointer_ungrab(GDK_CURRENT_TIME);
	abort();
}

I haven't tried the signal handler method, but I think I will .... :-)

Allan



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