From 59f6b77612d3e80fa579064ebdcccfd2127158c9 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Tue, 13 Apr 2021 10:23:25 +0200 Subject: [PATCH] Fix crash when stopping PipeWire streaming The stream object was deleted from a slot connected to its stopStreaming signal. This is unsafe and can lead to memory corruption and ultimately crashes when PipWwire streaming is stopped. Use deleteLater instead. BUG: 428268 435588 --- src/plugins/screencast/screencastmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/screencast/screencastmanager.cpp b/src/plugins/screencast/screencastmanager.cpp index d6da83699f..d5728cb81f 100644 --- a/src/plugins/screencast/screencastmanager.cpp +++ b/src/plugins/screencast/screencastmanager.cpp @@ -135,7 +135,7 @@ void ScreencastManager::integrateStreams(KWaylandServer::ScreencastStreamV1Inter connect(waylandStream, &KWaylandServer::ScreencastStreamV1Interface::finished, stream, &PipeWireStream::stop); connect(stream, &PipeWireStream::stopStreaming, waylandStream, [stream, waylandStream] { waylandStream->sendClosed(); - delete stream; + stream->deleteLater(); }); connect(stream, &PipeWireStream::streamReady, stream, [waylandStream] (uint nodeid) { waylandStream->sendCreated(nodeid);