mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
Use gst_object_unref() / gst_object_clear() instead of the GObject ones
To allow the refcounting tracer to work better. In childproxy/iterator these might be plain GObjects but gst_object_unref() also works on them. In other places where it is never GstObject, g_object_unref() is kept.
This commit is contained in:
parent
c8bcb9db18
commit
ed1022fa81
25 changed files with 52 additions and 55 deletions
|
@ -625,7 +625,7 @@ _add_element_pad_templates (GString * json, GstElement * element,
|
|||
g_string_append (json, ",\"object-type\": {");
|
||||
tmpobj = g_object_new (pad_type, NULL);
|
||||
_add_object_details (json, tmpobj);
|
||||
g_object_unref (tmpobj);
|
||||
gst_object_unref (tmpobj);
|
||||
g_string_append (json, "}");
|
||||
}
|
||||
g_string_append (json, "}");
|
||||
|
|
|
@ -1120,7 +1120,7 @@ gst_bin_do_deep_add_remove (GstBin * bin, gint sig_id, const gchar * sig_name,
|
|||
do {
|
||||
ires = gst_iterator_foreach (it, bin_deep_iterator_foreach, &elements);
|
||||
if (ires != GST_ITERATOR_DONE) {
|
||||
g_queue_foreach (&elements, (GFunc) g_object_unref, NULL);
|
||||
g_queue_foreach (&elements, (GFunc) gst_object_unref, NULL);
|
||||
g_queue_clear (&elements);
|
||||
}
|
||||
if (ires == GST_ITERATOR_RESYNC)
|
||||
|
@ -1139,7 +1139,7 @@ gst_bin_do_deep_add_remove (GstBin * bin, gint sig_id, const gchar * sig_name,
|
|||
" in bin %" GST_PTR_FORMAT, sig_name, e, parent);
|
||||
g_signal_emit (bin, sig_id, 0, parent, e);
|
||||
gst_object_unref (parent);
|
||||
g_object_unref (e);
|
||||
gst_object_unref (e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ gst_child_proxy_default_get_child_by_name (GstChildProxy * parent,
|
|||
break;
|
||||
}
|
||||
next:
|
||||
g_object_unref (object);
|
||||
gst_object_unref (object);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ gst_child_proxy_lookup (GstChildProxy * object, const gchar * name,
|
|||
GST_INFO ("no such object %s", current[0]);
|
||||
break;
|
||||
}
|
||||
g_object_unref (obj);
|
||||
gst_object_unref (obj);
|
||||
obj = next;
|
||||
current++;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ gst_child_proxy_lookup (GstChildProxy * object, const gchar * name,
|
|||
res = TRUE;
|
||||
}
|
||||
}
|
||||
g_object_unref (obj);
|
||||
gst_object_unref (obj);
|
||||
g_strfreev (names);
|
||||
return res;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ gst_child_proxy_get_property (GstChildProxy * object, const gchar * name,
|
|||
goto not_found;
|
||||
|
||||
g_object_get_property (target, pspec->name, value);
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
|
||||
return;
|
||||
|
||||
|
@ -319,7 +319,7 @@ gst_child_proxy_get_valist (GstChildProxy * object,
|
|||
|
||||
g_value_init (&value, pspec->value_type);
|
||||
g_object_get_property (target, pspec->name, &value);
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
|
||||
G_VALUE_LCOPY (&value, var_args, 0, &error);
|
||||
if (error)
|
||||
|
@ -388,7 +388,7 @@ gst_child_proxy_set_property (GstChildProxy * object, const gchar * name,
|
|||
goto not_found;
|
||||
|
||||
g_object_set_property (target, pspec->name, value);
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
return;
|
||||
|
||||
not_found:
|
||||
|
@ -433,7 +433,7 @@ gst_child_proxy_set_valist (GstChildProxy * object,
|
|||
goto cant_copy;
|
||||
|
||||
g_object_set_property (target, pspec->name, &value);
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
|
||||
g_value_unset (&value);
|
||||
name = va_arg (var_args, gchar *);
|
||||
|
@ -451,7 +451,7 @@ cant_copy:
|
|||
g_warning ("error copying value %s in object %s: %s", pspec->name,
|
||||
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""), error);
|
||||
g_value_unset (&value);
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
g_free (error);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ static void
|
|||
gst_list_iterator_free (GstListIterator * it)
|
||||
{
|
||||
if (it->owner)
|
||||
g_object_unref (it->owner);
|
||||
gst_object_unref (it->owner);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2886,7 +2886,7 @@ gst_pad_get_single_internal_link (GstPad * pad)
|
|||
ret = g_value_dup_object (&item);
|
||||
} else {
|
||||
/* More than one internal link found - don't bother reffing */
|
||||
g_clear_object (&ret);
|
||||
gst_clear_object (&ret);
|
||||
GST_DEBUG_OBJECT (pad,
|
||||
"Requested single internally linked pad, multiple found");
|
||||
done = TRUE;
|
||||
|
@ -2895,7 +2895,7 @@ gst_pad_get_single_internal_link (GstPad * pad)
|
|||
break;
|
||||
}
|
||||
case GST_ITERATOR_RESYNC:
|
||||
g_clear_object (&ret);
|
||||
gst_clear_object (&ret);
|
||||
gst_iterator_resync (iter);
|
||||
break;
|
||||
case GST_ITERATOR_ERROR:
|
||||
|
|
|
@ -622,7 +622,7 @@ gst_preset_default_get_property_names (GstPreset * preset)
|
|||
g_free (props);
|
||||
}
|
||||
|
||||
g_object_unref (child);
|
||||
gst_object_unref (child);
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
|
|
|
@ -747,10 +747,7 @@ gst_registry_chunks_load_feature (GstRegistry * registry, gchar ** in,
|
|||
fail:
|
||||
GST_INFO ("Reading plugin feature failed");
|
||||
if (feature) {
|
||||
if (GST_IS_OBJECT (feature))
|
||||
gst_object_unref (feature);
|
||||
else
|
||||
g_object_unref (feature);
|
||||
gst_object_unref (feature);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -578,7 +578,7 @@ gst_system_clock_set_default (GstClock * new_clock)
|
|||
clock = _the_system_clock;
|
||||
|
||||
if (clock != NULL)
|
||||
g_object_unref (clock);
|
||||
gst_object_unref (clock);
|
||||
|
||||
if (new_clock == NULL) {
|
||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "resetting default system clock");
|
||||
|
|
|
@ -358,7 +358,7 @@ out:
|
|||
if (G_IS_VALUE (&v))
|
||||
g_value_unset (&v);
|
||||
if (target)
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
return;
|
||||
|
||||
error:
|
||||
|
@ -446,7 +446,7 @@ out:
|
|||
if (G_IS_VALUE (&v))
|
||||
g_value_unset (&v);
|
||||
if (target)
|
||||
g_object_unref (target);
|
||||
gst_object_unref (target);
|
||||
return;
|
||||
|
||||
error:
|
||||
|
|
|
@ -405,7 +405,7 @@ unref_data (GstCollectData * data)
|
|||
if (data->priv->destroy_notify)
|
||||
data->priv->destroy_notify (data);
|
||||
|
||||
g_object_unref (data->pad);
|
||||
gst_object_unref (data->pad);
|
||||
if (data->buffer) {
|
||||
gst_buffer_unref (data->buffer);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ main (gint argc, gchar * argv[])
|
|||
GST_TIME_ARGS (end - start));
|
||||
|
||||
start = gst_util_get_timestamp ();
|
||||
g_object_unref (pipeline);
|
||||
gst_object_unref (pipeline);
|
||||
end = gst_util_get_timestamp ();
|
||||
g_print ("%" GST_TIME_FORMAT " - unreffing pipeline\n",
|
||||
GST_TIME_ARGS (end - start));
|
||||
|
|
|
@ -109,7 +109,7 @@ main (gint argc, gchar * argv[])
|
|||
GST_TIME_ARGS (end - start));
|
||||
|
||||
start = gst_util_get_timestamp ();
|
||||
g_object_unref (pipeline);
|
||||
gst_object_unref (pipeline);
|
||||
end = gst_util_get_timestamp ();
|
||||
g_print ("%" GST_TIME_FORMAT " - unreffing pipeline\n",
|
||||
GST_TIME_ARGS (end - start));
|
||||
|
|
|
@ -680,8 +680,8 @@ GST_START_TEST (test_allow_not_linked)
|
|||
gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED);
|
||||
|
||||
gst_element_release_request_pad (tee, src2);
|
||||
g_object_unref (src1);
|
||||
g_object_unref (src2);
|
||||
gst_object_unref (src1);
|
||||
gst_object_unref (src2);
|
||||
|
||||
fail_unless (gst_pad_push (srcpad,
|
||||
gst_buffer_ref (buffer)) == GST_FLOW_NOT_LINKED);
|
||||
|
|
|
@ -345,8 +345,8 @@ GST_START_TEST (test_pad_templates)
|
|||
test = g_object_new (gst_test_element_get_type (), NULL);
|
||||
test2 = g_object_new (gst_test_element2_get_type (), NULL);
|
||||
|
||||
g_object_unref (test);
|
||||
g_object_unref (test2);
|
||||
gst_object_unref (test);
|
||||
gst_object_unref (test2);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -763,8 +763,8 @@ GST_START_TEST (test_request_pad_templates)
|
|||
"sink"));
|
||||
gst_element_unlink (GST_ELEMENT (test), sink);
|
||||
|
||||
g_object_unref (test);
|
||||
g_object_unref (sink);
|
||||
gst_object_unref (test);
|
||||
gst_object_unref (sink);
|
||||
|
||||
/* gst_parse_launch */
|
||||
gst_plugin_register_static (GST_VERSION_MAJOR,
|
||||
|
|
|
@ -72,7 +72,7 @@ GST_START_TEST (test_create)
|
|||
factory = setup_factory ();
|
||||
fail_if (factory == NULL);
|
||||
|
||||
g_object_unref (factory);
|
||||
gst_object_unref (factory);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -93,7 +93,7 @@ GST_START_TEST (test_can_sink_any_caps)
|
|||
fail_if (!res);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
g_object_unref (factory);
|
||||
gst_object_unref (factory);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -114,7 +114,7 @@ GST_START_TEST (test_can_sink_all_caps)
|
|||
fail_if (res);
|
||||
gst_caps_unref (caps);
|
||||
|
||||
g_object_unref (factory);
|
||||
gst_object_unref (factory);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
|
@ -403,7 +403,7 @@ GST_START_TEST (test_fake_object_name_threaded_unique)
|
|||
g_free (name1);
|
||||
|
||||
/* free stuff */
|
||||
g_list_foreach (object_list, (GFunc) g_object_unref, NULL);
|
||||
g_list_foreach (object_list, (GFunc) gst_object_unref, NULL);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
|
@ -114,7 +114,7 @@ GST_START_TEST (test_param_spec_fraction)
|
|||
fail_unless_equals_int (n, 15);
|
||||
fail_unless_equals_int (d, 8);
|
||||
|
||||
g_object_unref (obj);
|
||||
gst_object_unref (obj);
|
||||
}
|
||||
|
||||
GST_END_TEST static Suite *
|
||||
|
|
|
@ -81,11 +81,11 @@ GST_START_TEST (test_set_default)
|
|||
gst_object_ref_sink (clock);
|
||||
gst_system_clock_set_default (clock);
|
||||
g_assert_cmpint (GST_OBJECT_REFCOUNT (static_clock), ==, 1);
|
||||
g_object_unref (static_clock);
|
||||
gst_object_unref (static_clock);
|
||||
static_clock = gst_system_clock_obtain ();
|
||||
fail_unless (static_clock == clock);
|
||||
g_assert_cmpint (GST_OBJECT_REFCOUNT (clock), ==, 3);
|
||||
g_object_unref (static_clock);
|
||||
gst_object_unref (static_clock);
|
||||
|
||||
/* Reset the default clock to the static one */
|
||||
gst_system_clock_set_default (NULL);
|
||||
|
@ -93,8 +93,8 @@ GST_START_TEST (test_set_default)
|
|||
fail_unless (static_clock != clock);
|
||||
g_assert_cmpint (GST_OBJECT_REFCOUNT (clock), ==, 1);
|
||||
g_assert_cmpint (GST_OBJECT_REFCOUNT (static_clock), ==, 2);
|
||||
g_object_unref (clock);
|
||||
g_object_unref (static_clock);
|
||||
gst_object_unref (clock);
|
||||
gst_object_unref (static_clock);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -221,7 +221,7 @@ GST_START_TEST (test_resolution)
|
|||
prev_t = now_t;
|
||||
g_thread_yield ();
|
||||
}
|
||||
g_object_unref (clock);
|
||||
gst_object_unref (clock);
|
||||
clock = NULL;
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ single_shot_wait_thread_func (gpointer data)
|
|||
g_mutex_unlock (&d->lock);
|
||||
}
|
||||
|
||||
g_object_unref (clock);
|
||||
gst_object_unref (clock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ GST_START_TEST (test_merge)
|
|||
gst_tag_list_unref (list2);
|
||||
gst_tag_list_unref (list1);
|
||||
|
||||
g_object_unref (enc);
|
||||
gst_object_unref (enc);
|
||||
}
|
||||
|
||||
GST_END_TEST
|
||||
|
@ -319,7 +319,7 @@ GST_START_TEST (test_threads)
|
|||
g_thread_join (threads[1]);
|
||||
g_thread_join (threads[2]);
|
||||
|
||||
g_object_unref (G_OBJECT (setter));
|
||||
gst_object_unref (G_OBJECT (setter));
|
||||
}
|
||||
|
||||
GST_END_TEST static Suite *
|
||||
|
|
|
@ -258,7 +258,7 @@ GST_START_TEST (test_set)
|
|||
|
||||
fail_unless (toc == NULL);
|
||||
|
||||
g_object_unref (enc);
|
||||
gst_object_unref (enc);
|
||||
}
|
||||
|
||||
GST_END_TEST static int spin_and_wait = 1;
|
||||
|
@ -369,7 +369,7 @@ GST_START_TEST (test_threads)
|
|||
g_thread_join (threads[1]);
|
||||
g_thread_join (threads[2]);
|
||||
|
||||
g_object_unref (G_OBJECT (setter));
|
||||
gst_object_unref (setter);
|
||||
}
|
||||
|
||||
GST_END_TEST static Suite *
|
||||
|
|
|
@ -90,7 +90,7 @@ GST_START_TEST (serialize_message_logging)
|
|||
str = (gchar *) messages->data;
|
||||
fail_unless (str != NULL);
|
||||
|
||||
g_object_unref (tr);
|
||||
gst_object_unref (tr);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -147,7 +147,7 @@ GST_START_TEST (serialize_static_record)
|
|||
g_free (str_val);
|
||||
|
||||
gst_structure_free (s);
|
||||
g_object_unref (tr);
|
||||
gst_object_unref (tr);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
|
@ -129,8 +129,8 @@ GST_START_TEST (test_launch_lines)
|
|||
fail_unless (efac != NULL);
|
||||
type = gst_element_factory_get_element_type (efac);
|
||||
fail_unless (type != 0);
|
||||
g_object_unref (efac);
|
||||
g_object_unref (efac);
|
||||
gst_object_unref (efac);
|
||||
gst_object_unref (efac);
|
||||
fail_unless (gst_element_register (NULL, "1__dentity", GST_RANK_NONE, type));
|
||||
|
||||
for (s = test_lines; *s != NULL; s++) {
|
||||
|
|
|
@ -67,7 +67,7 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
bus = gst_element_get_bus (playbin);
|
||||
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
|
||||
g_object_unref (bus);
|
||||
gst_object_unref (bus);
|
||||
|
||||
/* start play back and listed to events */
|
||||
gst_element_set_state (playbin, GST_STATE_PLAYING);
|
||||
|
@ -75,7 +75,7 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
/* cleanup */
|
||||
gst_element_set_state (playbin, GST_STATE_NULL);
|
||||
g_object_unref (playbin);
|
||||
gst_object_unref (playbin);
|
||||
g_source_remove (bus_watch_id);
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
/* cleanup */
|
||||
g_main_loop_unref (loop);
|
||||
g_object_unref (client_clock);
|
||||
gst_object_unref (client_clock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ main (gint argc, gchar * argv[])
|
|||
|
||||
bus = gst_element_get_bus (app->pipeline);
|
||||
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
|
||||
g_object_unref (bus);
|
||||
gst_object_unref (bus);
|
||||
|
||||
for (stream_cnt = 0; stream_cnt < NUM_STREAM; stream_cnt++) {
|
||||
gst_bin_add_many (GST_BIN (app->pipeline), app->audiotestsrc[stream_cnt],
|
||||
|
@ -225,7 +225,7 @@ main (gint argc, gchar * argv[])
|
|||
g_main_loop_run (loop);
|
||||
|
||||
gst_element_set_state (app->pipeline, GST_STATE_NULL);
|
||||
g_object_unref (app->pipeline);
|
||||
gst_object_unref (app->pipeline);
|
||||
g_source_remove (bus_watch_id);
|
||||
g_main_loop_unref (loop);
|
||||
|
||||
|
|
Loading…
Reference in a new issue