diff options
author | Vladimir Belyavsky <belyavskyv@gmail.com> | 2022-11-18 16:56:03 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-11-29 18:37:20 +0000 |
commit | 192330439a5154ed7a6b5a7e2b4b7e9a62712491 (patch) | |
tree | ad863c9224861439df6fd62915e74c5e4fce5370 | |
parent | macdeployqt: Fix QtMultimedia plugins deployment (diff) | |
download | qtbase-192330439a5154ed7a6b5a7e2b4b7e9a62712491.tar.xz qtbase-192330439a5154ed7a6b5a7e2b4b7e9a62712491.zip |
QSystemLocale[Win]: Catch potential WinRT exceptions
Some Windows SDKs seem to throw an exception from winrt::check_hresult()
We need to handle this accordingly.
Fixes: QTBUG-108605
Change-Id: I14ad3b6dbd9b5fdf0120f9d3336a4d922167d169
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7d7ed24f517aff2f4bf9f2e32a29603476af6c88)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/corelib/text/qlocale_win.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index 6dec3ddd52..f68c0584e7 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -663,9 +663,13 @@ QVariant QSystemLocalePrivate::uiLanguages() #if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) using namespace winrt; using namespace Windows::System::UserProfile; - auto languages = GlobalizationPreferences::Languages(); - for (const auto &lang : languages) - result << QString::fromStdString(winrt::to_string(lang)); + QT_TRY { + auto languages = GlobalizationPreferences::Languages(); + for (const auto &lang : languages) + result << QString::fromStdString(winrt::to_string(lang)); + } QT_CATCH(...) { + // pass, just fall back to WIN32 API implementation + } if (!result.isEmpty()) return result; // else just fall back to WIN32 API implementation #endif // QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) |