From 3886f3d1e4b29d028c1bacf474bc40d1c45c2ea9 Mon Sep 17 00:00:00 2001 From: Mark Furneaux Date: Mon, 22 Dec 2014 16:13:44 -0500 Subject: [PATCH] Fix socket leak in moodbarpipeline Fixes #4663 When tearing down the pipeline, there was a leak of a GstBus which holds a socketpair open. Eventually the OS runs out of file descriptors and terminates Clementine. --- src/moodbar/moodbarpipeline.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/moodbar/moodbarpipeline.cpp b/src/moodbar/moodbarpipeline.cpp index a12d5581f..7163efda1 100644 --- a/src/moodbar/moodbarpipeline.cpp +++ b/src/moodbar/moodbarpipeline.cpp @@ -190,8 +190,10 @@ void MoodbarPipeline::Cleanup() { Q_ASSERT(QThread::currentThread() != qApp->thread()); if (pipeline_) { - gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(pipeline_)), - nullptr, nullptr, nullptr); + GstBus* bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline_)); + gst_bus_set_sync_handler(bus, nullptr, nullptr, nullptr); + gst_object_unref(bus); + gst_element_set_state(pipeline_, GST_STATE_NULL); gst_object_unref(pipeline_); pipeline_ = nullptr;