This is something bindings can't handle and it causes leaks. Instead
move the ref_sink() to the explicit, new() constructors.
This means that abstract classes, and anything that can have subclasses,
will have to do ref_sink() in their new() function now. Specifically
this affects GstClock and GstControlSource.
https://bugzilla.gnome.org/show_bug.cgi?id=743062
14 files changed:
g_mutex_init (&bus->priv->queue_lock);
bus->priv->queue = gst_atomic_queue_new (32);
g_mutex_init (&bus->priv->queue_lock);
bus->priv->queue = gst_atomic_queue_new (32);
- /* clear floating flag */
- gst_object_ref_sink (bus);
-
GST_DEBUG_OBJECT (bus, "created");
}
GST_DEBUG_OBJECT (bus, "created");
}
result = g_object_new (gst_bus_get_type (), NULL);
GST_DEBUG_OBJECT (result, "created new bus");
result = g_object_new (gst_bus_get_type (), NULL);
GST_DEBUG_OBJECT (result, "created new bus");
+ /* clear floating flag */
+ gst_object_ref_sink (result);
+
priv->timeout = DEFAULT_TIMEOUT;
priv->times = g_new0 (GstClockTime, 4 * priv->window_size);
priv->times_temp = priv->times + 2 * priv->window_size;
priv->timeout = DEFAULT_TIMEOUT;
priv->times = g_new0 (GstClockTime, 4 * priv->window_size);
priv->times_temp = priv->times + 2 * priv->window_size;
-
- /* clear floating flag */
- gst_object_ref_sink (clock);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstControlSource, gst_control_source,
GST_TYPE_OBJECT, _do_init);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GstControlSource, gst_control_source,
GST_TYPE_OBJECT, _do_init);
-static GObject *gst_control_source_constructor (GType type,
- guint n_construct_params, GObjectConstructParam * construct_params);
-
static void
gst_control_source_class_init (GstControlSourceClass * klass)
{
static void
gst_control_source_class_init (GstControlSourceClass * klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- gobject_class->constructor = gst_control_source_constructor;
self->get_value_array = NULL;
}
self->get_value_array = NULL;
}
-static GObject *
-gst_control_source_constructor (GType type, guint n_construct_params,
- GObjectConstructParam * construct_params)
-{
- GObject *self;
-
- self =
- G_OBJECT_CLASS (gst_control_source_parent_class)->constructor (type,
- n_construct_params, construct_params);
- gst_object_ref_sink (self);
-
- return self;
-}
-
/**
* gst_control_source_get_value: (method)
* @self: the #GstControlSource object
/**
* gst_control_source_get_value: (method)
* @self: the #GstControlSource object
clock = g_object_new (GST_TYPE_SYSTEM_CLOCK,
"name", "GstSystemClock", NULL);
clock = g_object_new (GST_TYPE_SYSTEM_CLOCK,
"name", "GstSystemClock", NULL);
- g_assert (!g_object_is_floating (G_OBJECT (clock)));
-
+ /* Clear floating flag */
+ gst_object_ref_sink (clock);
_the_system_clock = clock;
g_mutex_unlock (&_gst_sysclock_mutex);
} else {
_the_system_clock = clock;
g_mutex_unlock (&_gst_sysclock_mutex);
} else {
g_mutex_lock (&pool_lock);
task->priv->pool = gst_object_ref (klass->pool);
g_mutex_unlock (&pool_lock);
g_mutex_lock (&pool_lock);
task->priv->pool = gst_object_ref (klass->pool);
g_mutex_unlock (&pool_lock);
-
- /* clear floating flag */
- gst_object_ref_sink (task);
GST_DEBUG ("Created task %p", task);
GST_DEBUG ("Created task %p", task);
+ /* clear floating flag */
+ gst_object_ref_sink (task);
+
static void
gst_task_pool_init (GstTaskPool * pool)
{
static void
gst_task_pool_init (GstTaskPool * pool)
{
- /* clear floating flag */
- gst_object_ref_sink (pool);
}
#ifndef GST_DISABLE_GST_DEBUG
}
#ifndef GST_DISABLE_GST_DEBUG
pool = g_object_new (GST_TYPE_TASK_POOL, NULL);
pool = g_object_new (GST_TYPE_TASK_POOL, NULL);
+ /* clear floating flag */
+ gst_object_ref_sink (pool);
+
pads->priv->seeking = FALSE;
pads->priv->pending_flush_start = FALSE;
pads->priv->pending_flush_stop = FALSE;
pads->priv->seeking = FALSE;
pads->priv->pending_flush_start = FALSE;
pads->priv->pending_flush_stop = FALSE;
-
- /* clear floating flag */
- gst_object_ref_sink (pads);
newcoll = g_object_new (GST_TYPE_COLLECT_PADS, NULL);
newcoll = g_object_new (GST_TYPE_COLLECT_PADS, NULL);
+ /* clear floating flag */
+ gst_object_ref_sink (newcoll);
+
GstClock *
gst_test_clock_new_with_start_time (GstClockTime start_time)
{
GstClock *
gst_test_clock_new_with_start_time (GstClockTime start_time)
{
g_assert_cmpuint (start_time, !=, GST_CLOCK_TIME_NONE);
g_assert_cmpuint (start_time, !=, GST_CLOCK_TIME_NONE);
- return g_object_new (GST_TYPE_TEST_CLOCK, "start-time", start_time, NULL);
+ clock = g_object_new (GST_TYPE_TEST_CLOCK, "start-time", start_time, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (clock);
+
+ return clock;
GstControlSource *
gst_interpolation_control_source_new (void)
{
GstControlSource *
gst_interpolation_control_source_new (void)
{
- return g_object_new (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, NULL);
+ GstControlSource *csource =
+ g_object_new (GST_TYPE_INTERPOLATION_CONTROL_SOURCE, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (csource);
+
+ return csource;
GstControlSource *
gst_lfo_control_source_new (void)
{
GstControlSource *
gst_lfo_control_source_new (void)
{
- return g_object_new (GST_TYPE_LFO_CONTROL_SOURCE, NULL);
+ GstControlSource *csource = g_object_new (GST_TYPE_LFO_CONTROL_SOURCE, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (csource);
+
+ return csource;
GstControlSource *
gst_trigger_control_source_new (void)
{
GstControlSource *
gst_trigger_control_source_new (void)
{
- return g_object_new (GST_TYPE_TRIGGER_CONTROL_SOURCE, NULL);
+ GstControlSource *csource =
+ g_object_new (GST_TYPE_TRIGGER_CONTROL_SOURCE, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (csource);
+
+ return csource;
g_object_new (GST_TYPE_NET_CLIENT_INTERNAL_CLOCK, "address",
self->priv->address, "port", self->priv->port, "is-ntp",
self->priv->is_ntp, NULL);
g_object_new (GST_TYPE_NET_CLIENT_INTERNAL_CLOCK, "address",
self->priv->address, "port", self->priv->port, "is-ntp",
self->priv->is_ntp, NULL);
+ gst_object_ref_sink (cache->clock);
clocks = g_list_prepend (clocks, cache);
/* Not actually leaked but is cached for a while before being disposed,
clocks = g_list_prepend (clocks, cache);
/* Not actually leaked but is cached for a while before being disposed,
* provided by the #GstNetTimeProvider on @remote_address and
* @remote_port.
*
* provided by the #GstNetTimeProvider on @remote_address and
* @remote_port.
*
- * Returns: a new #GstClock that receives a time from the remote
+ * Returns: (transfer full): a new #GstClock that receives a time from the remote
g_object_new (GST_TYPE_NET_CLIENT_CLOCK, "name", name, "address",
remote_address, "port", remote_port, "base-time", base_time, NULL);
g_object_new (GST_TYPE_NET_CLIENT_CLOCK, "name", name, "address",
remote_address, "port", remote_port, "base-time", base_time, NULL);
+ /* Clear floating flag */
+ gst_object_ref_sink (ret);
+
* Create a new #GstNtpClock that will report the time provided by
* the NTPv4 server on @remote_address and @remote_port.
*
* Create a new #GstNtpClock that will report the time provided by
* the NTPv4 server on @remote_address and @remote_port.
*
- * Returns: a new #GstClock that receives a time from the remote
+ * Returns: (transfer full): a new #GstClock that receives a time from the remote
g_object_new (GST_TYPE_NTP_CLOCK, "name", name, "address", remote_address,
"port", remote_port, "base-time", base_time, NULL);
g_object_new (GST_TYPE_NTP_CLOCK, "name", name, "address", remote_address,
"port", remote_port, "base-time", base_time, NULL);
+ gst_object_ref_sink (ret);
+
clock_name = g_strdup_printf ("ptp-clock-%u", domain->domain);
domain->domain_clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", clock_name, NULL);
clock_name = g_strdup_printf ("ptp-clock-%u", domain->domain);
domain->domain_clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", clock_name, NULL);
+ gst_object_ref_sink (domain->domain_clock);
g_free (clock_name);
g_queue_init (&domain->pending_syncs);
domain->last_path_delays_missing = 9;
g_free (clock_name);
g_queue_init (&domain->pending_syncs);
domain->last_path_delays_missing = 9;
clock_name = g_strdup_printf ("ptp-clock-%u", domain->domain);
domain->domain_clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", clock_name, NULL);
clock_name = g_strdup_printf ("ptp-clock-%u", domain->domain);
domain->domain_clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", clock_name, NULL);
+ gst_object_ref_sink (domain->domain_clock);
g_free (clock_name);
g_queue_init (&domain->pending_syncs);
domain->last_path_delays_missing = 9;
g_free (clock_name);
g_queue_init (&domain->pending_syncs);
domain->last_path_delays_missing = 9;
observation_system_clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "ptp-observation-clock",
NULL);
observation_system_clock =
g_object_new (GST_TYPE_SYSTEM_CLOCK, "name", "ptp-observation-clock",
NULL);
+ gst_object_ref_sink (observation_system_clock);
* check this with gst_clock_wait_for_sync(), the GstClock::synced signal and
* gst_clock_is_synced().
*
* check this with gst_clock_wait_for_sync(), the GstClock::synced signal and
* gst_clock_is_synced().
*
+ * Returns: (transfer full): A new #GstClock
+ *
* Since: 1.6
*/
GstClock *
gst_ptp_clock_new (const gchar * name, guint domain)
{
* Since: 1.6
*/
GstClock *
gst_ptp_clock_new (const gchar * name, guint domain)
{
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (domain <= G_MAXUINT8, NULL);
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (domain <= G_MAXUINT8, NULL);
- return g_object_new (GST_TYPE_PTP_CLOCK, "name", name, "domain", domain,
+ clock = g_object_new (GST_TYPE_PTP_CLOCK, "name", name, "domain", domain,
+
+ /* Clear floating flag */
+ gst_object_ref_sink (clock);
+
+ return clock;
static GstTestControlSource *
gst_test_control_source_new (void)
{
static GstTestControlSource *
gst_test_control_source_new (void)
{
- return g_object_new (GST_TYPE_TEST_CONTROL_SOURCE, NULL);
+ GstTestControlSource *csource =
+ g_object_new (GST_TYPE_TEST_CONTROL_SOURCE, NULL);
+
+ /* Clear floating flag */
+ gst_object_ref_sink (csource);
+
+ return csource;