From 9bc74d14f379ad58d7a80d5514a3db5be5012de0 Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Mon, 28 Nov 2022 14:27:47 +0100 Subject: [PATCH] Avoid a null pointer deref when openGL windows are present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit m_context2d in QWasmWindow might be null if the window uses OpenGL for rendering. It is dereferenced nevertheless in ::paint(), which should be avoided. Change-Id: Id817f3663bb475d55dfc916b4b7eb255a88cea9d Reviewed-by: Aleksandr Reviakin Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp index 4f9a9272778..842aaccc6e2 100644 --- a/src/plugins/platforms/wasm/qwasmwindow.cpp +++ b/src/plugins/platforms/wasm/qwasmwindow.cpp @@ -294,7 +294,7 @@ QWasmScreen *QWasmWindow::platformScreen() const void QWasmWindow::paint() { - if (!m_backingStore || !isVisible()) + if (!m_backingStore || !isVisible() || m_context2d.isUndefined()) return; auto image = m_backingStore->getUpdatedWebImage(this);