From: ghost Date: Tue, 27 Oct 2009 23:45:37 +0000 (+0100) Subject: servicemp3.cpp: fix possible segfault/asserting (bug #216) X-Git-Tag: 2.6.0~4 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/3b35f69ac92259f20cd69c08993a89c7a52f19ab servicemp3.cpp: fix possible segfault/asserting (bug #216) --- diff --git a/lib/service/servicemp3.cpp b/lib/service/servicemp3.cpp index 7701d4d5..7f87ffad 100644 --- a/lib/service/servicemp3.cpp +++ b/lib/service/servicemp3.cpp @@ -302,7 +302,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref) eDebug("eServiceMP3::sorry, can't play: missing gst-plugin-appsink"); else { - g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this); + m_subs_to_pull_handler_id = g_signal_connect (subsink, "new-buffer", G_CALLBACK (gstCBsubtitleAvail), this); g_object_set (G_OBJECT (m_gst_playbin), "text-sink", subsink, NULL); } @@ -340,10 +340,23 @@ eServiceMP3::eServiceMP3(eServiceReference ref) eServiceMP3::~eServiceMP3() { + // disconnect subtitle callback + GstElement *sink; + g_object_get (G_OBJECT (m_gst_playbin), "text-sink", &sink, NULL); + if (sink) + { + g_signal_handler_disconnect (sink, m_subs_to_pull_handler_id); + gst_object_unref(sink); + } + delete m_subtitle_widget; + + // disconnect sync handler callback + gst_bus_set_sync_handler(gst_pipeline_get_bus (GST_PIPELINE (m_gst_playbin)), NULL, NULL); + if (m_state == stRunning) stop(); - + if (m_stream_tags) gst_tag_list_free(m_stream_tags); diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index d2a8fb0b..15ed0b07 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -204,6 +204,7 @@ private: void pullSubtitle(); int m_subs_to_pull; eSingleLock m_subs_to_pull_lock; + gulong m_subs_to_pull_handler_id; RESULT seekToImpl(pts_t to);