mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
bus, clock: make sure these never have a floating ref
Clear the initial floating ref in the init function for busses and clocks. These objects can be set on multiple elements, so there's no clear parent-child relationship here. Ideally we'd just not make them derive from GInitiallyUnowned at all, but since we want to keep using GstObject features for debugging, we'll just do it like this. This should also fix some problems with bindings, which seem to get confused when they get floating refs from non-constructor functions (or functions annotated to have a 'transfer full' return type). This works now: from gi.repository import GObject, Gst GObject.threads_init() Gst.init(None) pipeline=Gst.Pipeline() bus = pipeline.get_bus() pipeline.set_state(Gst.State.NULL) del pipeline; https://bugzilla.gnome.org/show_bug.cgi?id=679286 https://bugzilla.gnome.org/show_bug.cgi?id=657202
This commit is contained in:
parent
e234651bd3
commit
c0c79188ca
4 changed files with 10 additions and 3 deletions
|
@ -228,6 +228,9 @@ gst_bus_init (GstBus * bus)
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -699,6 +699,9 @@ gst_clock_init (GstClock * clock)
|
|||
priv->time_index = 0;
|
||||
priv->timeout = DEFAULT_TIMEOUT;
|
||||
priv->times = g_new0 (GstClockTime, 4 * priv->window_size);
|
||||
|
||||
/* clear floating flag */
|
||||
gst_object_ref_sink (clock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -304,9 +304,7 @@ gst_system_clock_obtain (void)
|
|||
clock = g_object_new (GST_TYPE_SYSTEM_CLOCK,
|
||||
"name", "GstSystemClock", NULL);
|
||||
|
||||
/* we created the global clock; take ownership so
|
||||
* we can hand out instances later */
|
||||
gst_object_ref_sink (clock);
|
||||
g_assert (!g_object_is_floating (G_OBJECT (clock)));
|
||||
|
||||
_the_system_clock = clock;
|
||||
g_mutex_unlock (&_gst_sysclock_mutex);
|
||||
|
|
|
@ -125,6 +125,9 @@ GST_START_TEST (test_get_bus)
|
|||
ASSERT_OBJECT_REFCOUNT (pipeline, "pipeline after get_bus", 1);
|
||||
ASSERT_OBJECT_REFCOUNT (bus, "bus", 2);
|
||||
|
||||
/* bindings don't like the floating flag to be set here */
|
||||
fail_if (g_object_is_floating (bus));
|
||||
|
||||
gst_object_unref (pipeline);
|
||||
|
||||
ASSERT_OBJECT_REFCOUNT (bus, "bus after unref pipeline", 1);
|
||||
|
|
Loading…
Reference in a new issue