diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2007-11-07 11:48:09 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2007-11-07 11:48:09 +0000 |
commit | 3b310c00eb22d59e2a19d84707c4d8f7dec5b434 (patch) | |
tree | 2e2a70f4bc4e80c2fe254955f41c1485ff3f1b13 /ext/gio/gstgiosrc.c | |
parent | 1407259dbc44b0cf23c9e72770c990e5f8cac680 (diff) | |
download | gst-plugins-bad-3b310c00eb22d59e2a19d84707c4d8f7dec5b434.tar.gz gst-plugins-bad-3b310c00eb22d59e2a19d84707c4d8f7dec5b434.tar.bz2 gst-plugins-bad-3b310c00eb22d59e2a19d84707c4d8f7dec5b434.zip |
ext/gio/gstgio.c: Remove nowadays unnecessary workaround for a crash.
Original commit message from CVS:
* ext/gio/gstgio.c: (plugin_init):
Remove nowadays unnecessary workaround for a crash.
* ext/gio/gstgiosink.c: (gst_gio_sink_finalize),
(gst_gio_sink_start), (gst_gio_sink_stop),
(gst_gio_sink_unlock_stop):
* ext/gio/gstgiosink.h:
* ext/gio/gstgiosrc.c: (gst_gio_src_finalize), (gst_gio_src_start),
(gst_gio_src_stop), (gst_gio_src_unlock_stop):
* ext/gio/gstgiosrc.h:
Make the finalize function safer, clean up everything that could stay
around.
Reset the cancellable instead of creating a new one after cancelling
some operation.
Don't store the GFile in the element, it's only necessary for creating
the streams.
Diffstat (limited to 'ext/gio/gstgiosrc.c')
-rw-r--r-- | ext/gio/gstgiosrc.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/ext/gio/gstgiosrc.c b/ext/gio/gstgiosrc.c index 15e0b9d2..e984e143 100644 --- a/ext/gio/gstgiosrc.c +++ b/ext/gio/gstgiosrc.c @@ -128,12 +128,20 @@ gst_gio_src_finalize (GObject * object) { GstGioSrc *src = GST_GIO_SRC (object); - g_object_unref (src->cancel); + if (src->cancel) { + g_object_unref (src->cancel); + src->cancel = NULL; + } - if (src->file) - g_object_unref (src->file); + if (src->stream) { + g_object_unref (src->stream); + src->stream = NULL; + } - g_free (src->location); + if (src->location) { + g_free (src->location); + src->location = NULL; + } GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); } @@ -179,6 +187,7 @@ static gboolean gst_gio_src_start (GstBaseSrc * base_src) { GstGioSrc *src = GST_GIO_SRC (base_src); + GFile *file; GError *err = NULL; if (src->location == NULL) { @@ -186,15 +195,17 @@ gst_gio_src_start (GstBaseSrc * base_src) return FALSE; } - src->file = g_file_new_for_uri (src->location); + file = g_file_new_for_uri (src->location); - if (src->file == NULL) { + if (file == NULL) { GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL), ("Malformed URI or protocol not supported (%s)", src->location)); return FALSE; } - src->stream = g_file_read (src->file, src->cancel, &err); + src->stream = g_file_read (file, src->cancel, &err); + + g_object_unref (file); if (src->stream == NULL && !gst_gio_error (src, "g_file_read", &err, NULL)) { @@ -209,13 +220,9 @@ gst_gio_src_start (GstBaseSrc * base_src) g_clear_error (&err); - g_object_unref (src->file); - src->file = NULL; - return FALSE; } else if (src->stream == NULL) { - g_object_unref (src->file); return FALSE; } @@ -250,11 +257,6 @@ gst_gio_src_stop (GstBaseSrc * base_src) src->stream = NULL; } - if (src->file != NULL) { - g_object_unref (src->file); - src->file = NULL; - } - GST_DEBUG_OBJECT (src, "closed location %s", src->location); return success; @@ -321,10 +323,9 @@ gst_gio_src_unlock_stop (GstBaseSrc * base_src) { GstGioSrc *src = GST_GIO_SRC (base_src); - GST_LOG_OBJECT (src, "restoring cancellable"); + GST_LOG_OBJECT (src, "resetting cancellable"); - g_object_unref (src->cancel); - src->cancel = g_cancellable_new (); + g_cancellable_reset (src->cancel); return TRUE; } |