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
This commit is contained in:
Alois Wohlschlager 2021-04-13 10:23:25 +02:00
parent 68f58076f4
commit 59f6b77612
No known key found for this signature in database
GPG key ID: E0F59EA5E5216914

View file

@ -135,7 +135,7 @@ void ScreencastManager::integrateStreams(KWaylandServer::ScreencastStreamV1Inter
connect(waylandStream, &KWaylandServer::ScreencastStreamV1Interface::finished, stream, &PipeWireStream::stop); connect(waylandStream, &KWaylandServer::ScreencastStreamV1Interface::finished, stream, &PipeWireStream::stop);
connect(stream, &PipeWireStream::stopStreaming, waylandStream, [stream, waylandStream] { connect(stream, &PipeWireStream::stopStreaming, waylandStream, [stream, waylandStream] {
waylandStream->sendClosed(); waylandStream->sendClosed();
delete stream; stream->deleteLater();
}); });
connect(stream, &PipeWireStream::streamReady, stream, [waylandStream] (uint nodeid) { connect(stream, &PipeWireStream::streamReady, stream, [waylandStream] (uint nodeid) {
waylandStream->sendCreated(nodeid); waylandStream->sendCreated(nodeid);