+2008-04-25 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * gst/gstbin.c: (gst_bin_class_init), (gst_bin_init),
+ (gst_bin_dispose):
+ Use the GLib stuff to create a private structure.
+ Add some locking around some dispose methods to make them a little
+ safer, see #529723. Patch by: Antoine Tremblay <hexa00 at gmail dot com>
+
2008-04-25 Stefan Kost <ensonic@users.sf.net>
* libs/gst/base/gstbasesink.h:
* a toplevel bin */
#define BIN_IS_TOPLEVEL(bin) ((GST_OBJECT_PARENT (bin) == NULL) || bin->priv->asynchandling)
+#define GST_BIN_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BIN, GstBinPrivate))
+
struct _GstBinPrivate
{
gboolean asynchandling;
parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GstBinPrivate));
+
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bin_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bin_get_property);
bus);
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bin_bus_handler, bin);
- bin->priv = g_new0 (GstBinPrivate, 1);
+ bin->priv = GST_BIN_GET_PRIVATE (bin);
bin->priv->asynchandling = DEFAULT_ASYNC_HANDLING;
}
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
- bin_remove_messages (bin, NULL, GST_MESSAGE_ANY);
-
+ GST_OBJECT_LOCK (object);
gst_object_replace ((GstObject **) child_bus_p, NULL);
gst_object_replace ((GstObject **) provided_clock_p, NULL);
gst_object_replace ((GstObject **) clock_provider_p, NULL);
+ bin_remove_messages (bin, NULL, GST_MESSAGE_ANY);
+ GST_OBJECT_UNLOCK (object);
while (bin->children) {
gst_bin_remove (bin, GST_ELEMENT_CAST (bin->children->data));
GST_STR_NULL (GST_OBJECT_NAME (object)));
}
- if (bin->priv) {
- g_free (bin->priv);
- bin->priv = NULL;
- }
-
G_OBJECT_CLASS (parent_class)->dispose (object);
}