forked from AuroraMiddleware/gtk
1ff162c445
comment cleanups -timj
50 lines
2.0 KiB
Plaintext
50 lines
2.0 KiB
Plaintext
From timj@gimp.org Sat Jan 24 19:15:22 1998
|
|
Date: Sat, 24 Jan 1998 18:25:10 +0100 (CET)
|
|
From: Tim Janik <timj@gimp.org>
|
|
To: Peter Mattis <petm@xcf.berkeley.edu>
|
|
Cc: Gtk+ Devils <gtkdev@gimp.org>
|
|
Subject: widget destruction while in call
|
|
|
|
hi peter and gtk+ devils ;)
|
|
|
|
|
|
i've got the following problem, when double clicking on a list item
|
|
it's window should be destroyed, because the selection is made.
|
|
now this doesn't work 'cause the program is aborted with a
|
|
BadWindow error (from X).
|
|
|
|
this happens because the function that is connected to the lists
|
|
button_press_event calls gtk_widget_destroy () on the main window.
|
|
then the widget destruction is propagated through the tree until
|
|
the list widget should be destroyed. but since the list widget is
|
|
still GTK_IN_CALL (from the button_press_event) it isn't destroyed
|
|
but only flagged as GTK_NEED_DESTROY. at this point the propagation
|
|
stops, and nothing happends to the list widgets children.
|
|
after the return of the button_press_event handler, the clicked
|
|
list item is now selected/unselected (depends on the previous state).
|
|
it therefore updates its GdkWindow (XWindow) by setting the new
|
|
backgroundcolor (selected->blue/unselected->white). since it's
|
|
parent XWindows are destroyed already the window which the list item
|
|
wants to draw on is also destroyed. at this point the BadWindow error
|
|
occours cause the XWindow handle has become invalid (the application
|
|
already received a destroy notify).
|
|
|
|
now, solutions might be:
|
|
1) check for private->destroyed on *all* gdk call as it's done
|
|
it a lot of places already, or
|
|
2) propagate a widget unrealize signal through the tree before
|
|
destroying a widget, or
|
|
3) propagate GTK_NEED_DESTROY down the tree (not only flag the
|
|
list container), this would require gtk_object_destroy() to
|
|
return wether the object got actually destroyed or flagged
|
|
only. then prohibit gdk operations on widgets flagged as
|
|
GTK_NEED_DESTROY.
|
|
|
|
i'm not sure what the best solution might be, but i tend to favour
|
|
1) or 3).
|
|
|
|
|
|
---
|
|
ciaoTJ
|
|
|