diff options
author | Morten Sørvig <morten.sorvig@qt.io> | 2022-04-26 11:46:46 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@qt.io> | 2022-05-06 01:20:35 +0000 |
commit | e4cda635b134ccc1b94b5c802beb1d94f3a54789 (patch) | |
tree | 9f90cbdcfa3b73d5a453d39c13d89cea9a7f65c9 /src/plugins | |
parent | b8b3a8047f4a5d7e00ab303e2c10514a23ccf116 (diff) |
wasm: destroy compositor and screen in order
The QWasmCompositor destructor deregisters event handlers, which
means it needs to look up the the canvas element, which again means
that this needs to happen before we clear the canvas from
specialHTMLTargets.
Also, calling destroy() is not needed since the QWasmCompositor
destructor makes this call.
Change-Id: I3004b94d0459c28642d3bd8bf9fe794c9b658477
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/wasm/qwasmscreen.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index ef1fb39f5b..357ee327fe 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -119,13 +119,16 @@ QWasmScreen::QWasmScreen(const emscripten::val &containerOrCanvas) QWasmScreen::~QWasmScreen() { - emscripten::val specialHtmlTargets = emscripten::val::module_property("specialHTMLTargets"); + // Delete the compositor before removing the screen from specialHTMLTargets, + // since its destructor needs to look up the target when deregistering + // event handlers. + m_compositor = nullptr; + emscripten::val specialHtmlTargets = emscripten::val::module_property("specialHTMLTargets"); std::string id = std::string("!qtcanvas_") + std::to_string(uint32_t(this)); specialHtmlTargets.set(id, emscripten::val::undefined()); m_canvas.set(m_canvasResizeObserverCallbackContextPropertyName, emscripten::val(intptr_t(0))); - destroy(); } void QWasmScreen::destroy() |