summaryrefslogtreecommitdiff
path: root/src/plugins/platforms/wasm/qwasmintegration.cpp
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-05-06 11:41:36 +0200
committerMorten Sørvig <morten.sorvig@qt.io>2022-05-12 16:34:24 +0200
commit83106badcdeab65254bf15a338ea10db91785f3e (patch)
treedc8f877a12475bf357886cb59fcf26c9bf7682c3 /src/plugins/platforms/wasm/qwasmintegration.cpp
parentb119f26a5663c5e3f82d82ad41e479a42115d954 (diff)
downloadqtbase-83106badcdeab65254bf15a338ea10db91785f3e.tar.gz
wasm: always call destroy() before deleting a screen
QWasmCompositor currently has the requirement that destroying it requires freeing a GL texture, which requires a valid GL context, which requires a valid screen, in order to get to the native context on the canvas. For this reason QWasmScreen has a destroy() function which is called before deleting the QScreen and QPlatformScreen. Make sure we call destroy() also when deleting all screens in the QWasmIntegration destructor. Move the common logic into a new deleteScreen() function which replaces destroy(). Change-Id: I628f13c868808db539effff9b29ecbefac23abc9 Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: David Skoland <david.skoland@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmintegration.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmintegration.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/plugins/platforms/wasm/qwasmintegration.cpp b/src/plugins/platforms/wasm/qwasmintegration.cpp
index c6bb7f98c9..b7e1a0ad28 100644
--- a/src/plugins/platforms/wasm/qwasmintegration.cpp
+++ b/src/plugins/platforms/wasm/qwasmintegration.cpp
@@ -196,7 +196,8 @@ QWasmIntegration::~QWasmIntegration()
delete m_drag;
for (const auto &elementAndScreen : m_screens)
- QWindowSystemInterface::handleScreenRemoved(elementAndScreen.second);
+ elementAndScreen.second->deleteScreen();
+
m_screens.clear();
s_instance = nullptr;
@@ -338,10 +339,7 @@ void QWasmIntegration::removeScreen(const emscripten::val &element)
qWarning() << "Attempting to remove non-existing screen for element" << QWasmString::toQString(element["id"]);;
return;
}
- QWasmScreen *exScreen = it->second;
- m_screens.erase(it);
- exScreen->destroy(); // clean up before deleting the screen
- QWindowSystemInterface::handleScreenRemoved(exScreen);
+ it->second->deleteScreen();
}
void QWasmIntegration::resizeScreen(const emscripten::val &element)