summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
diff options
context:
space:
mode:
authorVladimir Belyavsky <belyavskyv@gmail.com>2023-01-13 14:03:09 +0300
committerVladimir Belyavsky <belyavskyv@gmail.com>2023-01-26 15:07:47 +0000
commitde704b633d4f9469a868e86fc22b8d99ef61eacb (patch)
tree3ab2911ea34e8202fccfa9404d8bdfc6f39ac049 /src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
parent2db23e151f5be3f35f0ba683ad7dc341dda806a1 (diff)
Windows: fix warning on opening FileDialog after changing filters
Destroy native file dialog on Windows as soon as it closes. Currently the instance of native file dialog on Windows may stay live even when a FileDialog control was closed and won't be opened anymore in the app session. At the same time, when the FileDialog is opened again, the instance of native file dialog is recreated so we don't need to keep previous instance, because this may lead to situation when QQuickFileDialog configures old instance of the native dialog, which is causing problems. Fixes: QTBUG-61042 Fixes: QTBUG-77211 Pick-to: 6.4 6.5 Change-Id: Ia537264e8494b83dec7d5139744838242b281f1f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsdialoghelpers.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 8f0cd3857e..7b49a424e2 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -236,7 +236,7 @@ QWindowsNativeDialogBase *QWindowsDialogHelperBase<BaseClass>::ensureNativeDialo
// Create dialog and apply common settings. Check "executed" flag as well
// since for example IFileDialog::Show() works only once.
if (m_nativeDialog.isNull() || m_nativeDialog->executed())
- m_nativeDialog = QWindowsNativeDialogBasePtr(createNativeDialog());
+ m_nativeDialog = QWindowsNativeDialogBasePtr(createNativeDialog(), &QObject::deleteLater);
return m_nativeDialog.data();
}
@@ -321,12 +321,13 @@ void QWindowsDialogHelperBase<BaseClass>::stopTimer()
}
}
-
template <class BaseClass>
void QWindowsDialogHelperBase<BaseClass>::hide()
{
- if (m_nativeDialog)
+ if (m_nativeDialog) {
m_nativeDialog->close();
+ m_nativeDialog.clear();
+ }
m_ownerWindow = nullptr;
}