diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp index 2798b06f2bd..e3cdf11fa27 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.cpp +++ b/src/plugins/platforms/wasm/qwasmintegration.cpp @@ -89,13 +89,13 @@ EMSCRIPTEN_BINDINGS(qtQWasmIntegraton) QWasmIntegration *QWasmIntegration::s_instance; QWasmIntegration::QWasmIntegration() - : m_fontDb(nullptr) + : m_suspendResume(std::make_shared()) // create early in order to register event handlers at startup + , m_fontDb(nullptr) , m_desktopServices(nullptr) , m_clipboard(new QWasmClipboard) #if QT_CONFIG(accessibility) , m_accessibility(new QWasmAccessibility) #endif - , m_suspendResume(std::make_shared()) // create early in order to register event handlers at startup { s_instance = this; diff --git a/src/plugins/platforms/wasm/qwasmintegration.h b/src/plugins/platforms/wasm/qwasmintegration.h index 50bed742c70..045f00de4dc 100644 --- a/src/plugins/platforms/wasm/qwasmintegration.h +++ b/src/plugins/platforms/wasm/qwasmintegration.h @@ -95,6 +95,9 @@ private: QWasmScreen *wasmScreen; }; + // m_suspendResume should be created first and destroyed early as other fields depend on it + std::shared_ptr m_suspendResume; + mutable QWasmFontDatabase *m_fontDb; mutable QWasmServices *m_desktopServices; mutable QHash m_backingStores; @@ -107,7 +110,6 @@ private: static QWasmIntegration *s_instance; QWasmInputContext *m_wasmInputContext = nullptr; - std::shared_ptr m_suspendResume; #if QT_CONFIG(draganddrop) std::unique_ptr m_drag;