From 893f95eed8534f0ba137660ce13a161b4468d3d0 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 1 Jul 2021 12:38:57 +0100 Subject: [PATCH] Guard against null compositor in thumbnail item If compositing is disabled, compositor will be null. We hit a path where we could destroyOffscreenTexture when the compositing is disabled then again when the Thumbnail is destroyed. In this case we query Compositor::self()->scene() and crash. --- src/scripting/thumbnailitem.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scripting/thumbnailitem.cpp b/src/scripting/thumbnailitem.cpp index 58879a9d57..61bdc35514 100644 --- a/src/scripting/thumbnailitem.cpp +++ b/src/scripting/thumbnailitem.cpp @@ -145,6 +145,9 @@ QSGTextureProvider *ThumbnailItemBase::textureProvider() const void ThumbnailItemBase::handleCompositingToggled() { + if (!Compositor::self()) { + return; + } Scene *scene = Compositor::self()->scene(); if (scene && scene->compositingType() == OpenGLCompositing) { connect(scene, &Scene::frameRendered, this, &ThumbnailItemBase::updateOffscreenTexture); @@ -167,6 +170,9 @@ void ThumbnailItemBase::setSourceSize(const QSize &sourceSize) void ThumbnailItemBase::destroyOffscreenTexture() { + if (!Compositor::self()) { + return; + } Scene *scene = Compositor::self()->scene(); if (!scene || scene->compositingType() != OpenGLCompositing) { return;