[farsight2/master] Remove code that abort if the objects are unrefed in the wrong order
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:20:27 PST 2008
---
gst-libs/gst/farsight/fs-base-conference.c | 49 +-------------------
gst-libs/gst/farsight/fs-session.c | 68 +---------------------------
gst-libs/gst/farsight/fs-stream.c | 34 +-------------
3 files changed, 6 insertions(+), 145 deletions(-)
diff --git a/gst-libs/gst/farsight/fs-base-conference.c b/gst-libs/gst/farsight/fs-base-conference.c
index 6f38d81..c9d7af2 100644
--- a/gst-libs/gst/farsight/fs-base-conference.c
+++ b/gst-libs/gst/farsight/fs-base-conference.c
@@ -59,8 +59,6 @@ enum
struct _FsBaseConferencePrivate
{
- /* List of Sessions */
- GPtrArray *session_list;
};
GST_BOILERPLATE_WITH_INTERFACE (
@@ -68,7 +66,6 @@ GST_BOILERPLATE_WITH_INTERFACE (
GstBin, GST_TYPE_BIN,
FsConference, FS_TYPE_CONFERENCE, fs_conference);
-static void fs_base_conference_finalize (GObject *object);
static void fs_base_conference_set_property (GObject *object, guint prop_id,
const GValue *value,
GParamSpec *pspec);
@@ -94,35 +91,13 @@ fs_base_conference_base_init (gpointer g_class)
}
static void
-fs_base_conference_finalize (GObject * object)
-{
- FsBaseConference *conf;
-
- conf = FS_BASE_CONFERENCE (object);
-
- /* Let's check if we have any remaining sessions in this
- * conference, if we do we need to exit since this is a fatal error by the
- * user because it results in unusable children objects */
- if (conf->priv->session_list->len)
- {
- g_error ("You may not unref your Farsight Conference Gstreamer "
- "element without first unrefing all underlying sessions, "
- "and streams! Exiting");
- }
-
- g_ptr_array_free (conf->priv->session_list, TRUE);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
fs_base_conference_class_init (FsBaseConferenceClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (FsBaseConferencePrivate));
+ // g_type_class_add_private (klass, sizeof (FsBaseConferencePrivate));
parent_class = g_type_class_peek_parent (klass);
@@ -130,8 +105,6 @@ fs_base_conference_class_init (FsBaseConferenceClass * klass)
GST_DEBUG_FUNCPTR (fs_base_conference_set_property);
gobject_class->get_property =
GST_DEBUG_FUNCPTR (fs_base_conference_get_property);
-
- gobject_class->finalize = GST_DEBUG_FUNCPTR (fs_base_conference_finalize);
}
static void
@@ -140,9 +113,7 @@ fs_base_conference_init (FsBaseConference *conf,
{
GST_DEBUG ("fs_base_conference_init");
- conf->priv = FS_BASE_CONFERENCE_GET_PRIVATE (conf);
-
- conf->priv->session_list = g_ptr_array_new();
+ // conf->priv = FS_BASE_CONFERENCE_GET_PRIVATE (conf);
}
static void
@@ -161,14 +132,6 @@ fs_conference_supported (
return TRUE;
}
-void _remove_session_ptr (FsBaseConference *conf, FsSession *session)
-{
- if (!g_ptr_array_remove (conf->priv->session_list, session))
- {
- GST_WARNING_OBJECT (conf, "FsSession not found in session ptr array");
- }
-}
-
static FsSession *
fs_base_conference_new_session (FsConference *conf,
FsMediaType media_type,
@@ -188,14 +151,6 @@ fs_base_conference_new_session (FsConference *conf,
/* Let's catch all session errors and send them over the GstBus */
g_signal_connect (new_session, "error",
G_CALLBACK (fs_base_conference_error), base_conf);
-
- /* Let's add a ptr to the new session into our ptr array */
- g_ptr_array_add (base_conf->priv->session_list, new_session);
-
- /* Let's add a weak reference to our new session, this way if it gets
- * unrefed we can remove it from our ptr list */
- g_object_weak_ref (G_OBJECT (new_session), (GWeakNotify)_remove_session_ptr,
- base_conf);
} else {
GST_WARNING_OBJECT (conf, "new_session not defined in element");
g_set_error (error, FS_ERROR, FS_ERROR_CONSTRUCTION,
diff --git a/gst-libs/gst/farsight/fs-session.c b/gst-libs/gst/farsight/fs-session.c
index d656a2f..a69a03b 100644
--- a/gst-libs/gst/farsight/fs-session.c
+++ b/gst-libs/gst/farsight/fs-session.c
@@ -73,10 +73,6 @@ enum
struct _FsSessionPrivate
{
- /* List of Streams */
- GPtrArray *stream_list;
-
- gboolean disposed;
};
G_DEFINE_ABSTRACT_TYPE(FsSession, fs_session, G_TYPE_OBJECT);
@@ -84,9 +80,6 @@ G_DEFINE_ABSTRACT_TYPE(FsSession, fs_session, G_TYPE_OBJECT);
#define FS_SESSION_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), FS_TYPE_SESSION, FsSessionPrivate))
-static void fs_session_dispose (GObject *object);
-static void fs_session_finalize (GObject *object);
-
static void fs_session_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -291,55 +284,14 @@ fs_session_class_init (FsSessionClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gobject_class->dispose = fs_session_dispose;
- gobject_class->finalize = fs_session_finalize;
-
- g_type_class_add_private (klass, sizeof (FsSessionPrivate));
+ // g_type_class_add_private (klass, sizeof (FsSessionPrivate));
}
static void
fs_session_init (FsSession *self)
{
/* member init */
- self->priv = FS_SESSION_GET_PRIVATE (self);
- self->priv->disposed = FALSE;
-
- self->priv->stream_list = g_ptr_array_new();
-}
-
-static void
-fs_session_dispose (GObject *object)
-{
- FsSession *self = FS_SESSION (object);
-
- if (self->priv->disposed) {
- /* If dispose did already run, return. */
- return;
- }
-
- /* Make sure dispose does not run twice. */
- self->priv->disposed = TRUE;
-
- parent_class->dispose (object);
-}
-
-static void
-fs_session_finalize (GObject *object)
-{
- FsSession *self = FS_SESSION (object);
-
- /* Let's check if we have any remaining streams in this
- * session, if we do we need to exit since this is a fatal error by the
- * user because it results in unusable children objects */
- if (self->priv->stream_list->len)
- {
- g_error ("You may not unref your Farsight Session object"
- " without first unrefing all underlying streams! Exiting");
- }
-
- g_ptr_array_free (self->priv->stream_list, TRUE);
-
- parent_class->finalize (object);
+ // self->priv = FS_SESSION_GET_PRIVATE (self);
}
static void
@@ -369,15 +321,6 @@ fs_session_error_forward (GObject *signal_src,
debug_msg);
}
-void
-_remove_stream_ptr (FsSession *session, FsStream *stream)
-{
- if (!g_ptr_array_remove (session->priv->stream_list, stream))
- {
- g_warning ("FsStream not found in stream ptr array");
- }
-}
-
/**
* fs_session_new_stream:
* @session: an #FsSession
@@ -421,13 +364,6 @@ fs_session_new_stream (FsSession *session, FsParticipant *participant,
g_signal_connect (new_stream, "error",
G_CALLBACK (fs_session_error_forward), session);
- /* Let's add a ptr to the new stream into our ptr array */
- g_ptr_array_add (session->priv->stream_list, new_stream);
-
- /* Let's add a weak reference to our new stream, this way if it gets
- * unrefed we can remove it from our ptr list */
- g_object_weak_ref (G_OBJECT (new_stream), (GWeakNotify)_remove_stream_ptr,
- session);
} else {
g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED,
"new_stream not defined for %s", G_OBJECT_TYPE_NAME (session));
diff --git a/gst-libs/gst/farsight/fs-stream.c b/gst-libs/gst/farsight/fs-stream.c
index 07e89f2..e91ca28 100644
--- a/gst-libs/gst/farsight/fs-stream.c
+++ b/gst-libs/gst/farsight/fs-stream.c
@@ -80,7 +80,6 @@ enum
struct _FsStreamPrivate
{
- gboolean disposed;
};
G_DEFINE_ABSTRACT_TYPE(FsStream, fs_stream, G_TYPE_OBJECT);
@@ -88,9 +87,6 @@ G_DEFINE_ABSTRACT_TYPE(FsStream, fs_stream, G_TYPE_OBJECT);
#define FS_STREAM_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), FS_TYPE_STREAM, FsStreamPrivate))
-static void fs_stream_dispose (GObject *object);
-static void fs_stream_finalize (GObject *object);
-
static void fs_stream_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -350,40 +346,14 @@ fs_stream_class_init (FsStreamClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- gobject_class->dispose = fs_stream_dispose;
- gobject_class->finalize = fs_stream_finalize;
-
- g_type_class_add_private (klass, sizeof (FsStreamPrivate));
+ // g_type_class_add_private (klass, sizeof (FsStreamPrivate));
}
static void
fs_stream_init (FsStream *self)
{
/* member init */
- self->priv = FS_STREAM_GET_PRIVATE (self);
- self->priv->disposed = FALSE;
-}
-
-static void
-fs_stream_dispose (GObject *object)
-{
- FsStream *self = FS_STREAM (object);
-
- if (self->priv->disposed) {
- /* If dispose did already run, return. */
- return;
- }
-
- /* Make sure dispose does not run twice. */
- self->priv->disposed = TRUE;
-
- parent_class->dispose (object);
-}
-
-static void
-fs_stream_finalize (GObject *object)
-{
- parent_class->finalize (object);
+ // self->priv = FS_STREAM_GET_PRIVATE (self);
}
static void
--
1.5.6.5
More information about the farsight-commits
mailing list