[libtaskmanager] Fix null check for window

window() may be null. We check for that, but 5a3ef9e825 introduced code that uses window() before the check.

Move the check before the relevant code to fix that

BUG: 456094

BUG: 457690
wilder-5.25
Nicolas Fella 4 years ago
parent 864b2b7797
commit 0acb09809c
  1. 8
      libtaskmanager/declarative/pipewiresourceitem.cpp

@ -231,12 +231,18 @@ void PipeWireSourceItem::updateTextureDmaBuf(const QVector<DmaBufPlane> &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<QOpenGLContext *>(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;
}

Loading…
Cancel
Save