mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
libs/gst/controller/gstcontroller.c: Take ref to controlled object so that it cannot disappear.
Original commit message from CVS: Patch by: René Stadler <mail at renestadler dot de> * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist), (gst_controller_new_list), (_gst_controller_dispose), (_gst_controller_finalize), (_gst_controller_class_init): Take ref to controlled object so that it cannot disappear. Fixes #357432.
This commit is contained in:
parent
c549303d73
commit
758c8c6929
2 changed files with 45 additions and 16 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2006-10-10 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
Patch by: René Stadler <mail at renestadler dot de>
|
||||
|
||||
* libs/gst/controller/gstcontroller.c: (gst_controller_new_valist),
|
||||
(gst_controller_new_list), (_gst_controller_dispose),
|
||||
(_gst_controller_finalize), (_gst_controller_class_init):
|
||||
Take ref to controlled object so that it cannot disappear.
|
||||
Fixes #357432.
|
||||
|
||||
2006-10-10 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* libs/gst/check/gstcheck.c: (gst_check_setup_src_pad),
|
||||
|
|
|
@ -483,7 +483,7 @@ gst_controller_new_valist (GObject * object, va_list var_args)
|
|||
/* if we don't have a controller object yet, now is the time to create one */
|
||||
if (!self) {
|
||||
self = g_object_new (GST_TYPE_CONTROLLER, NULL);
|
||||
self->object = object;
|
||||
self->object = g_object_ref (object);
|
||||
/* store the controller */
|
||||
g_object_set_qdata (object, __gst_controller_key, self);
|
||||
ref_existing = FALSE;
|
||||
|
@ -545,7 +545,7 @@ gst_controller_new_list (GObject * object, GList * list)
|
|||
/* if we don't have a controller object yet, now is the time to create one */
|
||||
if (!self) {
|
||||
self = g_object_new (GST_TYPE_CONTROLLER, NULL);
|
||||
self->object = object;
|
||||
self->object = g_object_ref (object);
|
||||
/* store the controller */
|
||||
g_object_set_qdata (object, __gst_controller_key, self);
|
||||
} else {
|
||||
|
@ -1186,25 +1186,43 @@ _gst_controller_set_property (GObject * object, guint property_id,
|
|||
}
|
||||
|
||||
static void
|
||||
_gst_controller_finalize (GObject * object)
|
||||
_gst_controller_dispose (GObject * object)
|
||||
{
|
||||
GstController *self = GST_CONTROLLER (object);
|
||||
GList *node;
|
||||
GstControlledProperty *prop;
|
||||
|
||||
if (self->object != NULL) {
|
||||
g_mutex_lock (self->lock);
|
||||
/* free list of properties */
|
||||
if (self->properties) {
|
||||
GList *node;
|
||||
|
||||
for (node = self->properties; node; node = g_list_next (node)) {
|
||||
prop = node->data;
|
||||
GstControlledProperty *prop = node->data;
|
||||
|
||||
g_signal_handler_disconnect (self->object, prop->notify_handler_id);
|
||||
gst_controlled_property_free (prop);
|
||||
}
|
||||
g_list_free (self->properties);
|
||||
self->properties = NULL;
|
||||
}
|
||||
g_mutex_free (self->lock);
|
||||
/* remove controller from objects qdata list */
|
||||
|
||||
/* remove controller from object's qdata list */
|
||||
g_object_set_qdata (self->object, __gst_controller_key, NULL);
|
||||
g_object_unref (self->object);
|
||||
self->object = NULL;
|
||||
g_mutex_unlock (self->lock);
|
||||
}
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||
(G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||
}
|
||||
|
||||
static void
|
||||
_gst_controller_finalize (GObject * object)
|
||||
{
|
||||
GstController *self = GST_CONTROLLER (object);
|
||||
|
||||
g_mutex_free (self->lock);
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->finalize)
|
||||
(G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
|
@ -1231,6 +1249,7 @@ _gst_controller_class_init (GstControllerClass * klass)
|
|||
|
||||
gobject_class->set_property = _gst_controller_set_property;
|
||||
gobject_class->get_property = _gst_controller_get_property;
|
||||
gobject_class->dispose = _gst_controller_dispose;
|
||||
gobject_class->finalize = _gst_controller_finalize;
|
||||
|
||||
__gst_controller_key = g_quark_from_string ("gst::controller");
|
||||
|
|
Loading…
Reference in a new issue