wasm: Fix use after delete of QWasmSuspendResumeControl
m_inputContext and other fields depends on the lifetime of m_suspendResume, but the latter gets destroyed first. Make sure that m_suspendResume is initialized first. Fixes: QTBUG-135378 Change-Id: Ifa2d58ec06a1f832549478bece3a8f651276ac8f Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
d139d22f7e
commit
b8ff842ace
@ -89,13 +89,13 @@ EMSCRIPTEN_BINDINGS(qtQWasmIntegraton)
|
|||||||
QWasmIntegration *QWasmIntegration::s_instance;
|
QWasmIntegration *QWasmIntegration::s_instance;
|
||||||
|
|
||||||
QWasmIntegration::QWasmIntegration()
|
QWasmIntegration::QWasmIntegration()
|
||||||
: m_fontDb(nullptr)
|
: m_suspendResume(std::make_shared<QWasmSuspendResumeControl>()) // create early in order to register event handlers at startup
|
||||||
|
, m_fontDb(nullptr)
|
||||||
, m_desktopServices(nullptr)
|
, m_desktopServices(nullptr)
|
||||||
, m_clipboard(new QWasmClipboard)
|
, m_clipboard(new QWasmClipboard)
|
||||||
#if QT_CONFIG(accessibility)
|
#if QT_CONFIG(accessibility)
|
||||||
, m_accessibility(new QWasmAccessibility)
|
, m_accessibility(new QWasmAccessibility)
|
||||||
#endif
|
#endif
|
||||||
, m_suspendResume(std::make_shared<QWasmSuspendResumeControl>()) // create early in order to register event handlers at startup
|
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
|
|
||||||
|
@ -95,6 +95,9 @@ private:
|
|||||||
QWasmScreen *wasmScreen;
|
QWasmScreen *wasmScreen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// m_suspendResume should be created first and destroyed early as other fields depend on it
|
||||||
|
std::shared_ptr<QWasmSuspendResumeControl> m_suspendResume;
|
||||||
|
|
||||||
mutable QWasmFontDatabase *m_fontDb;
|
mutable QWasmFontDatabase *m_fontDb;
|
||||||
mutable QWasmServices *m_desktopServices;
|
mutable QWasmServices *m_desktopServices;
|
||||||
mutable QHash<QWindow *, QWasmBackingStore *> m_backingStores;
|
mutable QHash<QWindow *, QWasmBackingStore *> m_backingStores;
|
||||||
@ -107,7 +110,6 @@ private:
|
|||||||
static QWasmIntegration *s_instance;
|
static QWasmIntegration *s_instance;
|
||||||
|
|
||||||
QWasmInputContext *m_wasmInputContext = nullptr;
|
QWasmInputContext *m_wasmInputContext = nullptr;
|
||||||
std::shared_ptr<QWasmSuspendResumeControl> m_suspendResume;
|
|
||||||
|
|
||||||
#if QT_CONFIG(draganddrop)
|
#if QT_CONFIG(draganddrop)
|
||||||
std::unique_ptr<QWasmDrag> m_drag;
|
std::unique_ptr<QWasmDrag> m_drag;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user