[screencast] Fix pipewire stream double free
Currently if a pipewire stream connect fails in PipeWireStream::createStream
, the stream is destroyed, but pwStream
is not nulled.
Then in screencastmanager.cpp, the error propagates up, and in ScreencastManager::integrateStreams
, because init()
fails, the PipeWireStream
object is immediately deleted.
In the PipeWireStream destructor, there is a check for pwStream
being null. Because it has been destroyed already in createStream
but not nulled, it is then destroyed again causing a malloc double free SIGABRT within pipewire.
If we correctly null pwStream
if createStream
fails, then this double free cannot occur.