wasm: remove onLanguageChanged event handler

QSystemLocale is setting the global window.onLanguageChanged
property which may cause conflicts in cases where there
are more than one Qt app instance on the same web page.

In addition the QSystemLocale destructor never runs,
which breaks also for repeated QLocale instantiations
on the same page (for example for the QLocale auto-
test)

Change-Id: I85af0587527b2922804fc866c83864f677700e6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3f74e2a633a809a27e8e66346e052dea48c4369e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2024-01-17 13:23:06 +01:00 committed by Qt Cherry-pick Bot
parent c9a9469f55
commit b2b1d02692
2 changed files with 0 additions and 14 deletions

View File

@ -720,17 +720,6 @@ QSystemLocale::QSystemLocale() : next(_systemLocale)
_systemLocale = this;
systemLocaleData.m_language_id = 0;
#ifdef Q_OS_WASM
onLanguageChanged = std::make_unique<qstdweb::EventCallback>(
emscripten::val::global("window"), "languagechange", [](emscripten::val) {
systemLocaleData.m_language_id = 0;
QEvent languageChangeEvent(QEvent::LanguageChange);
QCoreApplication::sendEvent(qApp, &languageChangeEvent);
QEvent localeChangeEvent(QEvent::LocaleChange);
QCoreApplication::sendEvent(qApp, &localeChangeEvent);
});
#endif
}
/*!

View File

@ -106,9 +106,6 @@ struct QLocaleData;
class Q_CORE_EXPORT QSystemLocale
{
QSystemLocale *next = nullptr; // Maintains a stack.
#ifdef Q_OS_WASM
std::unique_ptr<qstdweb::EventCallback> onLanguageChanged;
#endif
public:
QSystemLocale();