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.
This commit is contained in:
parent
f53cf9d71e
commit
893f95eed8
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue