From 4ecc45086102807901a3bd2b9e02a169ca212716 Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Thu, 9 Dec 2010 10:51:01 +0100 Subject: Fix a rare race condition when showing windows When setting a window to translucent shortly before showing it with the OpenGL graphics system, the hijacking would call XDestroyWindow without resetting the internal state. This might lead to the window waiting for a map notify message forever. The patch now properly resets the internal state when destroying the old window, so it'll get mapped correctly when show() is called. Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qwidget_x11.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 9085e98..ff6f215 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -905,8 +905,17 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO inputContext->setFocusWidget(q); } - if (destroyw) + if (destroyw) { qt_XDestroyWindow(q, dpy, destroyw); + if (QTLWExtra *topData = maybeTopData()) { +#ifndef QT_NO_XSYNC + if (topData->syncUpdateCounter) + XSyncDestroyCounter(dpy, topData->syncUpdateCounter); +#endif + // we destroyed our old window - reset the top-level state + createTLSysExtra(); + } + } // newly created windows are positioned at the window system's // (0,0) position. If the parent uses wrect mapping to expand the -- cgit v0.12