Commit b4a9f42c authored by Steve Baker Baker's avatar Steve Baker Baker
Browse files

reenabled object destruction by renaming shutdown and real_destry to dispose funcs

Original commit message from CVS:
reenabled object destruction by renaming shutdown and real_destry to dispose funcs
parent d4afd62f
......@@ -37,7 +37,7 @@ GstElementDetails gst_bin_details = {
};
static void gst_bin_real_destroy (GObject *object);
static void gst_bin_dispose (GObject *object);
static GstElementStateReturn gst_bin_change_state (GstElement *element);
static GstElementStateReturn gst_bin_change_state_norecurse (GstBin *bin);
......@@ -122,9 +122,7 @@ gst_bin_class_init (GstBinClass *klass)
#endif
gstelement_class->change_state = gst_bin_change_state;
// FIXME
// gobject_class->destroy = gst_bin_real_destroy;
gobject_class->dispose = gst_bin_dispose;
}
static void
......@@ -476,13 +474,13 @@ gst_bin_set_state_type (GstBin *bin,
}
static void
gst_bin_real_destroy (GObject *object)
gst_bin_dispose (GObject *object)
{
GstBin *bin = GST_BIN (object);
GList *children, *orig;
GstElement *child;
GST_DEBUG (GST_CAT_REFCOUNTING,"destroy()\n");
GST_DEBUG (GST_CAT_REFCOUNTING,"dispose\n");
if (bin->children) {
orig = children = g_list_copy (bin->children);
......@@ -501,9 +499,7 @@ gst_bin_real_destroy (GObject *object)
g_cond_free (bin->eoscond);
// FIXME!!!
// if (G_OBJECT_CLASS (parent_class)->destroy)
// G_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
/**
......
......@@ -56,8 +56,7 @@ static void gst_element_set_property (GObject *object, guint prop_id,
static void gst_element_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *pspec);
static void gst_element_shutdown (GObject *object);
static void gst_element_real_destroy (GObject *object);
static void gst_element_dispose (GObject *object);
static GstElementStateReturn gst_element_change_state (GstElement *element);
......@@ -140,9 +139,7 @@ gst_element_class_init (GstElementClass *klass)
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_element_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_element_get_property);
// gobject_class->shutdown = GST_DEBUG_FUNCPTR(gst_element_shutdown);
// FIXME!
// gobject_class->destroy = GST_DEBUG_FUNCPTR(gst_element_real_destroy);
gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_element_dispose);
#ifndef GST_DISABLE_LOADSAVE
gstobject_class->save_thyself = GST_DEBUG_FUNCPTR(gst_element_save_thyself);
......@@ -912,36 +909,23 @@ GST_ELEMENT_NAME(element),GST_ELEMENT_NAME(GST_ELEMENT_PARENT(element)),GST_ELEM
}
static void
gst_element_shutdown (GObject *object)
gst_element_dispose (GObject *object)
{
GstElement *element = GST_ELEMENT (object);
GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "shutdown\n");
GList *pads;
GstPad *pad;
GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "dispose\n");
if (GST_IS_BIN (GST_OBJECT_PARENT (element)))
gst_bin_remove (GST_BIN (GST_OBJECT_PARENT (element)), element);
// if (G_OBJECT_CLASS (parent_class)->shutdown)
// G_OBJECT_CLASS (parent_class)->shutdown (G_OBJECT (object));
}
static void
gst_element_real_destroy (GObject *object)
{
GstElement *element = GST_ELEMENT (object);
GList *pads;
GstPad *pad;
GST_DEBUG_ELEMENT (GST_CAT_REFCOUNTING, element, "destroy\n");
if (element->pads) {
GList *orig;
orig = pads = g_list_copy (element->pads);
while (pads) {
pad = GST_PAD (pads->data);
//gst_object_destroy (GST_OBJECT (pad));
gst_object_ref (GST_OBJECT (pad));
gst_element_remove_pad (element, pad);
gst_object_unref (GST_OBJECT (pad));
pads = g_list_next (pads);
}
......@@ -953,9 +937,7 @@ gst_element_real_destroy (GObject *object)
element->numsrcpads = 0;
element->numsinkpads = 0;
// FIXME!
// if (G_OBJECT_CLASS (parent_class)->destroy)
// G_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
/*
......
......@@ -226,8 +226,8 @@ gst_elementfactory_create (GstElementFactory *factory,
g_return_val_if_fail(factory != NULL, NULL);
g_return_val_if_fail(name != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"creating element from factory \"%s\" with name \"%s\"\n",
GST_OBJECT_NAME (factory), name);
GST_DEBUG (GST_CAT_ELEMENTFACTORY,"creating element from factory \"%s\" with name \"%s\" and type %d\n",
GST_OBJECT_NAME (factory), name, factory->type);
gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory));
......
......@@ -55,8 +55,7 @@ static guint gst_signal_object_signals[SO_LAST_SIGNAL] = { 0 };
static void gst_object_class_init (GstObjectClass *klass);
static void gst_object_init (GstObject *object);
static void gst_object_real_destroy (GObject *object);
static void gst_object_shutdown (GObject *object);
static void gst_object_dispose (GObject *object);
static void gst_object_finalize (GObject *object);
static GObjectClass *parent_class = NULL;
......@@ -111,8 +110,7 @@ gst_object_class_init (GstObjectClass *klass)
// FIXME!!!
// klass->signal_object = g_object_new(gst_signal_object_get_type (,NULL));
// gobject_class->shutdown = gst_object_shutdown;
// gobject_class->destroy = gst_object_real_destroy;
gobject_class->dispose = gst_object_dispose;
gobject_class->finalize = gst_object_finalize;
}
......@@ -143,6 +141,7 @@ gst_object_ref (GstObject *object)
G_OBJECT(object)->ref_count,G_OBJECT(object)->ref_count+1);
g_object_ref (G_OBJECT (object));
GST_DEBUG (GST_CAT_REFCOUNTING, "count now %d\n", G_OBJECT(object)->ref_count);
return object;
}
......@@ -164,6 +163,7 @@ gst_object_unref (GstObject *object)
G_OBJECT(object)->ref_count,G_OBJECT(object)->ref_count-1);
g_object_unref (G_OBJECT (object));
GST_DEBUG (GST_CAT_REFCOUNTING, "count now %d\n", G_OBJECT(object)->ref_count);
}
#define gst_object_unref gst_object_unref
......@@ -202,29 +202,19 @@ gst_object_destroy (GstObject *object)
* invocations.
*/
gst_object_ref (object);
// G_OBJECT_GET_CLASS (object)->shutdown (G_OBJECT (object));
G_OBJECT_GET_CLASS (object)->dispose (G_OBJECT (object));
gst_object_unref (object);
}
}
static void
gst_object_shutdown (GObject *object)
gst_object_dispose (GObject *object)
{
GST_DEBUG (GST_CAT_REFCOUNTING, "shutdown '%s'\n",GST_OBJECT_NAME(object));
GST_DEBUG (GST_CAT_REFCOUNTING, "dispose '%s'\n",GST_OBJECT_NAME(object));
GST_FLAG_SET (GST_OBJECT (object), GST_DESTROYED);
// parent_class->shutdown (object);
}
/* finilize is called when the object has to free its resources */
static void
gst_object_real_destroy (GObject *g_object)
{
GST_DEBUG (GST_CAT_REFCOUNTING, "destroy '%s'\n",GST_OBJECT_NAME(g_object));
GST_OBJECT_PARENT (g_object) = NULL;
GST_OBJECT_PARENT (object) = NULL;
// FIXME!!
// parent_class->destroy (g_object);
parent_class->dispose (object);
}
/* finilize is called when the object has to free its resources */
......@@ -343,6 +333,8 @@ gst_object_unparent (GstObject *object)
if (object->parent == NULL)
return;
GST_DEBUG (GST_CAT_REFCOUNTING, "unparent '%s'\n",GST_OBJECT_NAME(object));
object->parent = NULL;
gst_object_unref (object);
}
......
......@@ -103,7 +103,7 @@ static void gst_real_pad_init (GstRealPad *pad);
static void gst_real_pad_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_real_pad_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void gst_real_pad_destroy (GObject *object);
static void gst_real_pad_dispose (GObject *object);
static void gst_pad_push_func (GstPad *pad, GstBuffer *buf);
......@@ -144,8 +144,7 @@ gst_real_pad_class_init (GstRealPadClass *klass)
real_pad_parent_class = g_type_class_ref(GST_TYPE_PAD);
// FIXME!
// gobject_class->destroy = GST_DEBUG_FUNCPTR(gst_real_pad_destroy);
gobject_class->dispose = GST_DEBUG_FUNCPTR(gst_real_pad_dispose);
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_real_pad_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_real_pad_get_property);
......@@ -1023,21 +1022,27 @@ gst_pad_get_bufferpool (GstPad *pad)
}
static void
gst_real_pad_destroy (GObject *object)
gst_real_pad_dispose (GObject *object)
{
GstPad *pad = GST_PAD (object);
GST_DEBUG (GST_CAT_REFCOUNTING, "dispose %s:%s\n", GST_DEBUG_PAD_NAME(pad));
GST_DEBUG (GST_CAT_REFCOUNTING, "destroy %s:%s\n", GST_DEBUG_PAD_NAME(pad));
if (GST_PAD (pad)->padtemplate)
if (GST_PAD (pad)->padtemplate){
GST_DEBUG (GST_CAT_REFCOUNTING, "unreffing padtemplate'%s'\n",GST_OBJECT_NAME(GST_OBJECT (GST_PAD (pad)->padtemplate)));
gst_object_unref (GST_OBJECT (GST_PAD (pad)->padtemplate));
if (GST_PAD_PEER (pad))
}
if (GST_PAD_PEER (pad)){
GST_DEBUG (GST_CAT_REFCOUNTING, "disconnecting pad '%s'\n",GST_OBJECT_NAME(GST_OBJECT (GST_PAD (GST_PAD_PEER (pad)))));
gst_pad_disconnect (pad, GST_PAD (GST_PAD_PEER (pad)));
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad)))
}
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad))){
GST_DEBUG (GST_CAT_REFCOUNTING, "removing pad from element '%s'\n",GST_OBJECT_NAME(GST_OBJECT (GST_ELEMENT (GST_OBJECT_PARENT (pad)))));
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad);
}
// FIXME we should destroy the ghostpads, because they are nothing without the real pad
if (GST_REAL_PAD (pad)->ghostpads) {
GList *orig, *ghostpads;
......@@ -1047,18 +1052,17 @@ gst_real_pad_destroy (GObject *object)
while (ghostpads) {
GstPad *ghostpad = GST_PAD (ghostpads->data);
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (ghostpad)))
if (GST_IS_ELEMENT (GST_OBJECT_PARENT (ghostpad))){
GST_DEBUG (GST_CAT_REFCOUNTING, "removing ghost pad from element '%s'\n", GST_OBJECT_NAME(GST_OBJECT_PARENT (ghostpad)));
gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (ghostpad)), ghostpad);
}
ghostpads = g_list_next (ghostpads);
}
g_list_free (orig);
g_list_free (GST_REAL_PAD(pad)->ghostpads);
}
// FIXME !!
// if (G_OBJECT_CLASS (real_pad_parent_class)->destroy)
// G_OBJECT_CLASS (real_pad_parent_class)->destroy (object);
G_OBJECT_CLASS (real_pad_parent_class)->dispose (object);
}
......
......@@ -61,7 +61,7 @@ enum {
static void gst_thread_class_init (GstThreadClass *klass);
static void gst_thread_init (GstThread *thread);
static void gst_thread_real_destroy (GObject *object);
static void gst_thread_dispose (GObject *object);
static void gst_thread_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_thread_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
......@@ -121,8 +121,7 @@ gst_thread_class_init (GstThreadClass *klass)
g_param_spec_boolean("create_thread", "Create Thread", "Whether to create a thread.",
TRUE,G_PARAM_READWRITE));
// FIXME!
// gobject_class->destroy = gst_thread_real_destroy;
gobject_class->dispose = gst_thread_dispose;
#ifndef GST_DISABLE_LOADSAVE
gstobject_class->save_thyself = gst_thread_save_thyself;
......@@ -162,21 +161,20 @@ gst_thread_init (GstThread *thread)
}
static void
gst_thread_real_destroy (GObject *object)
gst_thread_dispose (GObject *object)
{
GstThread *thread = GST_THREAD (object);
GST_DEBUG (GST_CAT_REFCOUNTING,"destroy()\n");
GST_DEBUG (GST_CAT_REFCOUNTING,"dispose\n");
g_mutex_free (thread->lock);
g_cond_free (thread->cond);
// FIXME!
// if (G_OBJECT_CLASS (parent_class)->destroy)
// G_OBJECT_CLASS (parent_class)->destroy (object);
G_OBJECT_CLASS (parent_class)->dispose (object);
gst_object_destroy (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
gst_object_unref (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment