Re: emitting the "delete_event" in a "key_press_event" --> crash
- From: Olivier Sessink <olivier lx student wau nl>
- To: Olexiy Avramchenko <ath beast stu cn ua>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: emitting the "delete_event" in a "key_press_event" --> crash
- Date: Thu, 07 Nov 2002 15:29:28 +0100
On Thu, 07 Nov 2002 16:16:43 +0200 "Olexiy Avramchenko"
<ath beast stu cn ua> wrote:
1. You allocates a piece of memory: testwin = g_new(...);
2. Then you pass testwin as a parameter to "delete_event" and "destroy"
callbacks
(wich are the same function).
3. "delete_event" signalled - callback called first time.
4. You call gtk_widget_destroy() inside callback, GtkObjects code will
emit "destroy"
some ns later.
5. "destroy" signalled - callback called second time.
6. You call gtk_widget_destroy() inside callback, no "destroy" will be
emitted this time,
because GtkObject knows that dispose process is running.
7. You call gfree() - testwin freed.
8. Getting out from second callback's call.
9. You call gfree() on already freed on stage 7) testwin - this is a
bug. 10. One more bug - you are not returning value from "delete_event"
callback. But this
is not much important here, because you've called gtk_widget_destroy().
ok, but this is fixed now because I only connect to destroy_event now, and
not to delete_event anymore.
thanks,
Olivier
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]