From 660ad887ee3eec7374ef83a1d04d0cec9e8ebd19 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 28 Apr 2023 00:21:24 +0200 Subject: [PATCH] screencast: Disable screencasting when a window closes There were still some cases where we might have queried the window, leading to a crash. BUG: 469055 --- src/plugins/screencast/screencaststream.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index 921740796d..9ae96bc5d4 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -313,7 +313,10 @@ ScreenCastStream::ScreenCastStream(ScreenCastSource *source, QObject *parent) , m_source(source) , m_resolution(source->textureSize()) { - connect(source, &ScreenCastSource::closed, this, &ScreenCastStream::stopStreaming); + connect(source, &ScreenCastSource::closed, this, [this] { + m_streaming = false; + Q_EMIT stopStreaming(); + }); pwStreamEvents.version = PW_VERSION_STREAM_EVENTS; pwStreamEvents.add_buffer = &ScreenCastStream::onStreamAddBuffer;