Windows: Filter out events sent during DestroyWindow().

Task-number: QTBUG-26933

Change-Id: Ie7aaf9f0c9c12a33b059e796a3be161a2d60c64e
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
This commit is contained in:
Friedemann Kleint 2012-10-08 16:10:14 +02:00 committed by The Qt Project
parent fe8eb057fa
commit 0de7440cc6
3 changed files with 7 additions and 2 deletions

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -126,7 +126,8 @@ public:
SizeGripOperation = 0x100,
FrameStrutEventsEnabled = 0x200,
SynchronousGeometryChangeEvent = 0x400,
WithinSetStyle = 0x800
WithinSetStyle = 0x800,
WithinDestroy = 0x1000
};
struct WindowData