aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-10-28 00:45:37 +0100
committerghost <andreas.monzner@multimedia-labs.de>2009-10-28 00:45:37 +0100
commit3b35f69ac92259f20cd69c08993a89c7a52f19ab (patch)
treed7fa56ebf4d15a9751fb33ac52f7905b0232896d
parent64de540e03c8ab04712797079e5fc76eb0135baa (diff)
downloadenigma2-3b35f69ac92259f20cd69c08993a89c7a52f19ab.tar.gz
enigma2-3b35f69ac92259f20cd69c08993a89c7a52f19ab.zip
servicemp3.cpp: fix possible segfault/asserting (bug #216)
-rw-r--r--lib/service/servicemp3.cpp17
-rw-r--r--lib/service/servicemp3.h1
2 files changed, 16 insertions, 2 deletions
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);