Bug fix #93: Assertion failure when window reparented

- Fix an assertion failure that occurs when a window is reparented to
  the root window then immediately to another window. Thanks to smlx for
  reporting.

- Add extra debugging info for ReparentNotify.
This commit is contained in:
Richard Grenville 2013-03-03 21:53:08 +08:00
parent e3eca7ac61
commit b3652f6746
1 changed files with 10 additions and 3 deletions

View File

@ -2505,9 +2505,11 @@ add_win(session_t *ps, Window id, Window prev) {
new->id = id; new->id = id;
set_ignore_next(ps); set_ignore_next(ps);
if (!XGetWindowAttributes(ps->dpy, id, &new->a)) { if (!XGetWindowAttributes(ps->dpy, id, &new->a)
// Failed to get window attributes. Which probably means, the window || IsUnviewable == new->a.map_state) {
// is gone already. // Failed to get window attributes probably means the window is gone
// already. IsUnviewable means the window is already reparented
// elsewhere.
free(new); free(new);
return false; return false;
} }
@ -3446,6 +3448,11 @@ ev_unmap_notify(session_t *ps, XUnmapEvent *ev) {
inline static void inline static void
ev_reparent_notify(session_t *ps, XReparentEvent *ev) { ev_reparent_notify(session_t *ps, XReparentEvent *ev) {
#ifdef DEBUG_EVENTS
printf_dbg(" { new_parent: %#010lx, override_redirect: %d }\n",
ev->parent, ev->override_redirect);
#endif
if (ev->parent == ps->root) { if (ev->parent == ps->root) {
add_win(ps, ev->window, 0); add_win(ps, ev->window, 0);
} else { } else {