Commit e4b27986 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Xaver Hugl
Browse files

screencasting: Do not crash when the platform cannot provide textures

When using the QPainter backend, we will be getting null textures. Just
ignore these as the backend isn't all that important.

BUG: 442711


(cherry picked from commit 9bda050d)
parent f0cce272
......@@ -75,6 +75,11 @@ private:
return;
}
QSharedPointer<GLTexture> frameTexture(m_toplevel->effectWindow()->sceneWindow()->windowTexture());
if (!frameTexture) {
// Some backends will return no-op because textures aren't really supported there
return;
}
const bool wasYInverted = frameTexture->isYInverted();
frameTexture->setYInverted(false);
......@@ -118,6 +123,10 @@ void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamV1Interface
auto bufferToStream = [streamOutput, stream] (const QRegion &damagedRegion) {
auto scene = Compositor::self()->scene();
auto texture = scene->textureForOutput(streamOutput);
if (!texture) {
// Some backends will return no-op because textures aren't really supported there
return;
}
const QRect frame({}, streamOutput->modeSize());
const QRegion region = damagedRegion.isEmpty() || streamOutput->pixelSize() != streamOutput->modeSize() ? frame : damagedRegion.translated(-streamOutput->geometry().topLeft()).intersected(frame);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment