summaryrefslogtreecommitdiff
path: root/gst/rtsp-server/rtsp-session-pool.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-01-19 19:32:28 +0100
committerWim Taymans <wim@wtay.(none)>2009-01-19 19:32:28 +0100
commit243b524f5140395c9786c1d2828b6bf54c06f961 (patch)
tree672540fc281958e3a248f50576bcc7da0fe798d6 /gst/rtsp-server/rtsp-session-pool.c
parenta76656ad8d032afe3cad4e377fd89df5e63364d6 (diff)
Do some more cleanup of the session pool.
Diffstat (limited to 'gst/rtsp-server/rtsp-session-pool.c')
-rw-r--r--gst/rtsp-server/rtsp-session-pool.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/gst/rtsp-server/rtsp-session-pool.c b/gst/rtsp-server/rtsp-session-pool.c
index 716e888..a58be9d 100644
--- a/gst/rtsp-server/rtsp-session-pool.c
+++ b/gst/rtsp-server/rtsp-session-pool.c
@@ -21,6 +21,9 @@
#undef DEBUG
+static void gst_rtsp_session_pool_finalize (GObject * object);
+
+
G_DEFINE_TYPE (GstRTSPSessionPool, gst_rtsp_session_pool, G_TYPE_OBJECT);
static void
@@ -29,6 +32,8 @@ gst_rtsp_session_pool_class_init (GstRTSPSessionPoolClass * klass)
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = gst_rtsp_session_pool_finalize;
}
static void
@@ -36,7 +41,18 @@ gst_rtsp_session_pool_init (GstRTSPSessionPool * pool)
{
pool->lock = g_mutex_new ();
pool->sessions = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, NULL);
+ g_free, g_object_unref);
+}
+
+static void
+gst_rtsp_session_pool_finalize (GObject * object)
+{
+ GstRTSPSessionPool * pool = GST_RTSP_SESSION_POOL (object);
+
+ g_mutex_free (pool->lock);
+ g_hash_table_unref (pool->sessions);
+
+ G_OBJECT_CLASS (gst_rtsp_session_pool_parent_class)->finalize (object);
}
/**
@@ -157,9 +173,5 @@ gst_rtsp_session_pool_remove (GstRTSPSessionPool *pool, GstRTSPSession *sess)
g_mutex_lock (pool->lock);
found = g_hash_table_remove (pool->sessions, sess);
g_mutex_unlock (pool->lock);
-
- if (found) {
- g_object_unref (sess);
- }
}