diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index cd11d82d2d..e7bb997da9 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -291,6 +291,7 @@ QWindowsContext::~QWindowsContext() if (d->m_oleInitializeResult == S_OK || d->m_oleInitializeResult == S_FALSE) OleUninitialize(); + d->m_screenManager.clearScreens(); // Order: Potentially calls back to the windows. m_instance = 0; } diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index b2c85247f6..dccd582473 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -304,11 +304,6 @@ QWindowsScreenManager::QWindowsScreenManager() : { } -QWindowsScreenManager::~QWindowsScreenManager() -{ - qDeleteAll(m_screens); -} - /*! \brief Triggers synchronization of screens (WM_DISPLAYCHANGE). diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 7edf2ad0f5..c2cf0b4523 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -114,7 +114,8 @@ public: typedef QList WindowsScreenList; QWindowsScreenManager(); - ~QWindowsScreenManager(); + + inline void clearScreens() { qDeleteAll(m_screens); m_screens.clear(); } void handleScreenChanges(); bool handleDisplayChange(WPARAM wParam, LPARAM lParam);