Windows: Destroy tablet support before unregistering window classes.

Silences warnings in tests that instantiate QGuiApplication multiple
times.

QSYSTEM: tst_QGuiApplication::removePostedEvents() QApplication::regClass: Registering window class 'TabletDummyWindow' failed. (Class already exists.)
QSYSTEM: tst_QGuiApplication::removePostedEvents() UnregisterClass failed for 'TabletDummyWindow' (Class still has open windows.)

Change-Id: I6af2d38a2debd35f4dc0d48c09244dff022bd6b8
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
This commit is contained in:
Friedemann Kleint 2014-02-12 15:45:38 +01:00 committed by The Qt Project
parent 03aabe6c6e
commit e8ba6922c3

View File

@ -330,6 +330,9 @@ QWindowsContext::QWindowsContext() :
QWindowsContext::~QWindowsContext()
{
#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE)
d->m_tabletSupport.reset(); // Destroy internal window before unregistering classes.
#endif
unregisterWindowClasses();
if (d->m_oleInitializeResult == S_OK || d->m_oleInitializeResult == S_FALSE)
OleUninitialize();
@ -517,8 +520,10 @@ void QWindowsContext::unregisterWindowClasses()
{
const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0);
foreach (const QString &name, d->m_registeredWindowClassNames)
UnregisterClass((wchar_t*)name.utf16(), appInstance);
foreach (const QString &name, d->m_registeredWindowClassNames) {
if (!UnregisterClass((wchar_t*)name.utf16(), appInstance) && QWindowsContext::verbose)
qErrnoWarning("UnregisterClass failed for '%s'", qPrintable(name));
}
d->m_registeredWindowClassNames.clear();
}