diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-05-03 09:18:22 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-05-03 09:18:22 +0000 |
commit | 24e21ae6e9d0cc81b5fb93668848437e6a851df9 (patch) | |
tree | 755e37a240fb7294865ff7638dc2c6b08b78f6af /ext/gconf/gstswitchsink.c | |
parent | 34f916abbd9284552603810e3a0d4abf3e831dbd (diff) |
ext/gconf/: When we can't create a fakesink/fakesrc complain instead of unreffing
Original commit message from CVS:
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_reset),
(gst_gconf_audio_src_change_state):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_reset),
(gst_gconf_video_sink_change_state):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_reset),
(gst_gconf_video_src_change_state):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_reset),
(gst_switch_commit_new_kid), (gst_switch_sink_change_state):
When we can't create a fakesink/fakesrc complain instead of unreffing
NULL pointers and crashing later. See bug #530535.
Diffstat (limited to 'ext/gconf/gstswitchsink.c')
-rw-r--r-- | ext/gconf/gstswitchsink.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/gconf/gstswitchsink.c b/ext/gconf/gstswitchsink.c index d8da2ae0..6c9fff17 100644 --- a/ext/gconf/gstswitchsink.c +++ b/ext/gconf/gstswitchsink.c @@ -76,15 +76,17 @@ gst_switch_sink_class_init (GstSwitchSinkClass * klass) } } -static void +static gboolean gst_switch_sink_reset (GstSwitchSink * sink) { /* this will install fakesink if no other child has been set, * otherwise we rely on the subclass to know when to unset its * custom kid */ if (sink->kid == NULL) { - gst_switch_sink_set_child (sink, NULL); + return gst_switch_sink_set_child (sink, NULL); } + + return TRUE; } static void @@ -143,6 +145,10 @@ gst_switch_commit_new_kid (GstSwitchSink * sink) if (new_kid == NULL) { GST_DEBUG_OBJECT (sink, "Replacing kid with fakesink"); new_kid = gst_element_factory_make ("fakesink", "testsink"); + if (new_kid == NULL) { + GST_ERROR_OBJECT (sink, "Failed to create fakesink"); + return FALSE; + } /* Add a reference, as it would if the element came from sink->new_kid */ gst_object_ref (new_kid); g_object_set (new_kid, "sync", TRUE, NULL); @@ -299,7 +305,8 @@ gst_switch_sink_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_READY_TO_NULL: - gst_switch_sink_reset (sink); + if (!gst_switch_sink_reset (sink)) + ret = GST_STATE_CHANGE_FAILURE; break; default: break; |