mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
glvideomixer: fix race retrieving the GL context from the display
_get_gl_context() can be called concurrently from either propose_allocation() or decide_allocation(). If it so happens that this happens at the same time, the check for whether we already had a GL context was outside the lock. Inside the lock and loop, the first thing that happens is that we unref the current GL context (if valid) as if there was a conflict adding it to the display. If the timing was unlucky, subsequent use of the GL context would be referencing an already unreffed GL context object resulting in a critical: g_object_ref: assertion 'object->ref_count > 0' failed https://bugzilla.gnome.org/show_bug.cgi?id=766703
This commit is contained in:
parent
396932f412
commit
11bb4454a8
1 changed files with 2 additions and 2 deletions
|
@ -195,8 +195,8 @@ _get_gl_context (GstGLBaseMixer * mix)
|
||||||
|
|
||||||
_find_local_gl_context (mix);
|
_find_local_gl_context (mix);
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (mix->display);
|
||||||
if (!mix->context) {
|
if (!mix->context) {
|
||||||
GST_OBJECT_LOCK (mix->display);
|
|
||||||
do {
|
do {
|
||||||
if (mix->context) {
|
if (mix->context) {
|
||||||
gst_object_unref (mix->context);
|
gst_object_unref (mix->context);
|
||||||
|
@ -213,8 +213,8 @@ _get_gl_context (GstGLBaseMixer * mix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!gst_gl_display_add_context (mix->display, mix->context));
|
} while (!gst_gl_display_add_context (mix->display, mix->context));
|
||||||
GST_OBJECT_UNLOCK (mix->display);
|
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (mix->display);
|
||||||
|
|
||||||
{
|
{
|
||||||
GstGLAPI current_gl_api = gst_gl_context_get_gl_api (mix->context);
|
GstGLAPI current_gl_api = gst_gl_context_get_gl_api (mix->context);
|
||||||
|
|
Loading…
Reference in a new issue