summaryrefslogtreecommitdiff
path: root/kde-plasma/xdg-desktop-portal-kde/files/xdg-desktop-portal-kde-5.27.4.1-dont-try-to-screencast-nullptr.patch
blob: 85d71e3951dc1871bd40e0dcd8f59af0269a90a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 58313fac8188163c9445bb9a212405412258ef5e Mon Sep 17 00:00:00 2001
From: Aleix Pol Gonzalez <aleixpol@kde.org>
Date: Wed, 5 Apr 2023 16:36:48 +0000
Subject: [PATCH] screencast: Don't try to screencast nullptr

For some reason we were received an output that was null. Account for it
by notifying and outputing some more information in hopes of fixing it
soon.

CCBUG: 467622
---
 src/waylandintegration.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/waylandintegration.cpp b/src/waylandintegration.cpp
index c929b030..be6e19f7 100644
--- a/src/waylandintegration.cpp
+++ b/src/waylandintegration.cpp
@@ -282,6 +282,14 @@ WaylandIntegration::Stream WaylandIntegration::WaylandIntegrationPrivate::startS
 WaylandIntegration::Stream WaylandIntegration::WaylandIntegrationPrivate::startStreamingOutput(quint32 outputName, Screencasting::CursorMode mode)
 {
     auto output = m_outputMap.value(outputName).output();
+    if (!output) {
+        qCWarning(XdgDesktopPortalKdeWaylandIntegration) << "Cannot stream, output not found" << outputName << m_outputMap.keys();
+        auto notification = new KNotification(QStringLiteral("screencastfailure"), KNotification::CloseOnTimeout);
+        notification->setTitle(i18n("Failed to start screencasting"));
+        notification->setIconName(QStringLiteral("dialog-error"));
+        notification->sendEvent();
+        return {};
+    }
     m_streamedScreenPosition = output->globalPosition();
     return startStreaming(m_screencasting->createOutputStream(output.data(), mode),
                           {
-- 
GitLab