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 Pick-to: 6.2 6.4 Change-Id: I14ad3b6dbd9b5fdf0120f9d3336a4d922167d169 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
b93720472e
commit
7d7ed24f51
@ -665,9 +665,13 @@ QVariant QSystemLocalePrivate::uiLanguages()
|
||||
#if QT_CONFIG(cpp_winrt)
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user