From: Friedemann Kleint Date: Mon, 8 Oct 2012 14:10:14 +0000 (+0200) Subject: Windows: Filter out events sent during DestroyWindow(). X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0de7440cc6ba0403588d1b5f8a6a557c7216334a;p=profile%2Fivi%2Fqtbase.git Windows: Filter out events sent during DestroyWindow(). Task-number: QTBUG-26933 Change-Id: Ie7aaf9f0c9c12a33b059e796a3be161a2d60c64e Reviewed-by: Miikka Heikkinen --- diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index bd69bf8..0dade2c 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -776,6 +776,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } } if (platformWindow) { + // Suppress events sent during DestroyWindow() for native children. + if (platformWindow->testFlag(QWindowsWindow::WithinDestroy)) + return false; if (QWindowsContext::verboseEvents > 1) qDebug().nospace() << "Event window: " << platformWindow->window(); } else { diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 955617e..eb9b364 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -737,10 +737,10 @@ void QWindowsWindow::destroyWindow() if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << this << window() << m_data.hwnd; if (m_data.hwnd) { // Stop event dispatching before Window is destroyed. + setFlag(WithinDestroy); if (hasMouseCapture()) setMouseGrabEnabled(false); unregisterDropSite(); - QWindowsContext::instance()->removeWindow(m_data.hwnd); #ifdef QT_OPENGL_ES_2 if (m_eglSurface) { if (QWindowsContext::verboseGL) @@ -760,6 +760,7 @@ void QWindowsWindow::destroyWindow() #endif if (m_data.hwnd != GetDesktopWindow()) DestroyWindow(m_data.hwnd); + QWindowsContext::instance()->removeWindow(m_data.hwnd); m_data.hwnd = 0; } } diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 3c9d415..4b17928 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -126,7 +126,8 @@ public: SizeGripOperation = 0x100, FrameStrutEventsEnabled = 0x200, SynchronousGeometryChangeEvent = 0x400, - WithinSetStyle = 0x800 + WithinSetStyle = 0x800, + WithinDestroy = 0x1000 }; struct WindowData