Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix MoodbarPipeline crash on gstreamer error.
As reported in issue 6302, playing a stream that causes gstreamer to error at start can cause a crash. The problem occurs when the MoodbarPipeline receives a pad-added signal after it has handled an error callback. In the error callback, the builder_ is freed. In the pad-added handler (NewPadCallback), this object is accessed. This change adds a running_ flag that we is set when the pipeline is started and cleared on an error. We check this flag at the beginning of NewPadCallback. For sanity sake, we also check the builder_ pointer before dereferencing. This solution is not complete as there still some syncronization issues. With this specific situation, the error and new pad callbacks appear to always occur on the same thread, but it's probably not true for all error conditions. The object is also destroyed by a different thread, so it's possible that an async callback may occur at the wrong time during the deletion of the object. See clementine-player#6302
- Loading branch information