Re: emitting the "delete_event" in a "key_press_event" --> crash



Olivier <olivier lx student wau nl> writes:

Hi all,

I want my dialogs to close when the user presses the escape key. So I
attached to the key_press_event, and if the key is escape I emit the
delete event. Immediately the delete event destroys the window, and then
the programs continues with the key-press-event (on a widget that doesn't
exist anymore!!) and crashes (tha backtrace says it segfaults somewhere
inside gtk).

Small test case? Escape is automatically hooked up for GTK+ dialogs and
doesn't usually crash GTK+, so there must be something else going on
here.

(Bug report filed in bugzilla would be appreciated)

(In general, you want to simply gtk_widget_destroy() the window, instead
of sending a delete event. Does that also crash GTK+?)
 
how do I do this in a way that doesn't crash gtk?

Adding an idle function that does a work (g_idle_add()) is frequently
a good way to get around reentrancy problems, but GTK+ really shouldn't
crash here.

Regards,
                                        Owen




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