From 0acb09809cd700b1571263b94f6f506d2d08a32b Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Wed, 10 Aug 2022 17:16:37 +0200 Subject: [PATCH] [libtaskmanager] Fix null check for window window() may be null. We check for that, but 5a3ef9e8253029569deb645af625e2bdd53e95e9 introduced code that uses window() before the check. Move the check before the relevant code to fix that BUG: 456094 BUG: 457690 --- libtaskmanager/declarative/pipewiresourceitem.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libtaskmanager/declarative/pipewiresourceitem.cpp b/libtaskmanager/declarative/pipewiresourceitem.cpp index b666a9383..08fb17dca 100644 --- a/libtaskmanager/declarative/pipewiresourceitem.cpp +++ b/libtaskmanager/declarative/pipewiresourceitem.cpp @@ -231,12 +231,18 @@ void PipeWireSourceItem::updateTextureDmaBuf(const QVector &planes, qCWarning(PIPEWIRE_LOGGING) << "glEGLImageTargetTexture2DOES is not available" << window(); return; } + + if (!window()) { + qCWarning(PIPEWIRE_LOGGING) << "Window not available" << this; + return; + } + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) const auto openglContext = window()->openglContext(); #else const auto openglContext = static_cast(window()->rendererInterface()->getResource(window(), QSGRendererInterface::OpenGLContextResource)); #endif - if (!window() || !openglContext || !m_stream) { + if (!openglContext || !m_stream) { qCWarning(PIPEWIRE_LOGGING) << "need a window and a context" << window(); return; }