summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2005-10-08 08:50:37 +0000
committerWim Taymans <wim.taymans@gmail.com>2005-10-08 08:50:37 +0000
commitbd17e7c6116c7f0de1781b9eb36b54c76e37df38 (patch)
tree93b3ab62b78db5c9cdce5040fef5e89adc170645 /gst
parent25a70411d2cf335aa9f6673b494a310b148584fe (diff)
gst/tcp/gstmultifdsink.c: Fix crasher when going to NULL multiple times.
Original commit message from CVS: * gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init), (gst_multifdsink_finalize), (multifdsink_hash_remove), (gst_multifdsink_stop): Fix crasher when going to NULL multiple times.
Diffstat (limited to 'gst')
-rw-r--r--gst/tcp/gstmultifdsink.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c
index 3b8e43231..650357a33 100644
--- a/gst/tcp/gstmultifdsink.c
+++ b/gst/tcp/gstmultifdsink.c
@@ -221,6 +221,7 @@ gst_client_status_get_type (void)
static void gst_multifdsink_base_init (gpointer g_class);
static void gst_multifdsink_class_init (GstMultiFdSinkClass * klass);
static void gst_multifdsink_init (GstMultiFdSink * multifdsink);
+static void gst_multifdsink_finalize (GObject * object);
static void gst_multifdsink_remove_client_link (GstMultiFdSink * sink,
GList * link);
@@ -293,6 +294,7 @@ gst_multifdsink_class_init (GstMultiFdSinkClass * klass)
gobject_class->set_property = gst_multifdsink_set_property;
gobject_class->get_property = gst_multifdsink_get_property;
+ gobject_class->finalize = gst_multifdsink_finalize;
g_object_class_install_property (gobject_class, ARG_PROTOCOL,
g_param_spec_enum ("protocol", "Protocol", "The protocol to wrap data in",
@@ -463,6 +465,20 @@ gst_multifdsink_init (GstMultiFdSink * this)
this->sync_method = DEFAULT_SYNC_METHOD;
}
+static void
+gst_multifdsink_finalize (GObject * object)
+{
+ GstMultiFdSink *this;
+
+ this = GST_MULTIFDSINK (object);
+
+ CLIENTS_LOCK_FREE (this);
+ g_hash_table_destroy (this->fd_hash);
+ g_array_free (this->bufqueue, TRUE);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
void
gst_multifdsink_add (GstMultiFdSink * sink, int fd)
{
@@ -1722,6 +1738,12 @@ socket_pair:
}
static gboolean
+multifdsink_hash_remove (gpointer key, gpointer value, gpointer data)
+{
+ return TRUE;
+}
+
+static gboolean
gst_multifdsink_stop (GstBaseSink * bsink)
{
GstMultiFdSinkClass *fclass;
@@ -1761,9 +1783,8 @@ gst_multifdsink_stop (GstBaseSink * bsink)
gst_fdset_free (this->fdset);
this->fdset = NULL;
}
+ g_hash_table_foreach_remove (this->fd_hash, multifdsink_hash_remove, this);
GST_FLAG_UNSET (this, GST_MULTIFDSINK_OPEN);
- CLIENTS_LOCK_FREE (this);
- g_hash_table_destroy (this->fd_hash);
return TRUE;
}