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>
This commit is contained in:
parent
d9c1ab0bf5
commit
192330439a
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user