Return to the two-step destruction in compositor
The two-step destruction we used to employ is needed as destroying a screen which contains a window crashes. Change-Id: I722828be5408a7f079d66e845eeee34ed19cbf34 Reviewed-by: Lorn Potter <lorn.potter@gmail.com> (cherry picked from commit 644036b597137306959d875127cc819612ee9217) Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
33895a9b6d
commit
c613c5ce22
@ -65,10 +65,14 @@ QWasmCompositor::~QWasmCompositor()
|
||||
if (m_requestAnimationFrameId != -1)
|
||||
emscripten_cancel_animation_frame(m_requestAnimationFrameId);
|
||||
|
||||
deregisterEventHandlers();
|
||||
destroy();
|
||||
}
|
||||
|
||||
void QWasmCompositor::onScreenDeleting()
|
||||
{
|
||||
deregisterEventHandlers();
|
||||
}
|
||||
|
||||
void QWasmCompositor::deregisterEventHandlers()
|
||||
{
|
||||
QByteArray screenElementSelector = screen()->eventTargetId().toUtf8();
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
void raise(QWasmWindow *window);
|
||||
void lower(QWasmWindow *window);
|
||||
|
||||
void onScreenDeleting();
|
||||
|
||||
QWindow *windowAt(QPoint globalPoint, int padding = 0) const;
|
||||
QWindow *keyWindow() const;
|
||||
|
||||
|
@ -92,8 +92,6 @@ QWasmScreen::QWasmScreen(const emscripten::val &containerOrCanvas)
|
||||
|
||||
QWasmScreen::~QWasmScreen()
|
||||
{
|
||||
Q_ASSERT(!m_compositor); // deleteScreen should have been called to remove this screen
|
||||
|
||||
emscripten::val::module_property("specialHTMLTargets")
|
||||
.set(eventTargetId().toStdString(), emscripten::val::undefined());
|
||||
|
||||
@ -103,9 +101,7 @@ QWasmScreen::~QWasmScreen()
|
||||
|
||||
void QWasmScreen::deleteScreen()
|
||||
{
|
||||
// Delete the compositor before removing the screen, since its destruction routine needs to use
|
||||
// the fully operational screen.
|
||||
m_compositor.reset();
|
||||
m_compositor->onScreenDeleting();
|
||||
// Deletes |this|!
|
||||
QWindowSystemInterface::handleScreenRemoved(this);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user