mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
memory: Keep a reference to the allocator
Otherwise the allocator might get freed while it's still used by the memory
This commit is contained in:
parent
209f081ab8
commit
d50190ba55
1 changed files with 2 additions and 1 deletions
|
@ -90,6 +90,7 @@ _gst_memory_free (GstMemory * mem)
|
||||||
gst_memory_unref (mem->parent);
|
gst_memory_unref (mem->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_unref (mem->allocator);
|
||||||
gst_allocator_free (mem->allocator, mem);
|
gst_allocator_free (mem->allocator, mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ gst_memory_init (GstMemory * mem, GstMemoryFlags flags,
|
||||||
(GstMiniObjectCopyFunction) _gst_memory_copy, NULL,
|
(GstMiniObjectCopyFunction) _gst_memory_copy, NULL,
|
||||||
(GstMiniObjectFreeFunction) _gst_memory_free);
|
(GstMiniObjectFreeFunction) _gst_memory_free);
|
||||||
|
|
||||||
mem->allocator = allocator;
|
mem->allocator = g_object_ref (allocator);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
gst_memory_lock (parent, GST_LOCK_FLAG_EXCLUSIVE);
|
gst_memory_lock (parent, GST_LOCK_FLAG_EXCLUSIVE);
|
||||||
gst_memory_ref (parent);
|
gst_memory_ref (parent);
|
||||||
|
|
Loading…
Reference in a new issue