From e356b7d1ed3e8bff2240fa0567170d380248cc69 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Wed, 16 Dec 2009 01:33:39 +0100 Subject: [PATCH] [410/906] gstglmixer: inactivate shared gl context before to release ours First, inactivate shared gl contexts known by each sink pad. Then, destroy the gl context known by the glmixer. Finally, re-activate shared gl contexts. This is to satisfy the fact that no shared gl context must be current when an opengl context is destroyed. Moreover the application may hang or crash without those steps. --- gst-libs/gst/gl/gstglmixer.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/gl/gstglmixer.c b/gst-libs/gst/gl/gstglmixer.c index f43a6498b1..a206e1ac1e 100644 --- a/gst-libs/gst/gl/gstglmixer.c +++ b/gst-libs/gst/gl/gstglmixer.c @@ -1274,10 +1274,8 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition) while (walk) { GstGLMixerPad *sink_pad = GST_GL_MIXER_PAD (walk->data); walk = g_slist_next (walk); - if (sink_pad->display) { - g_object_unref (sink_pad->display); - sink_pad->display = NULL; - } + if (sink_pad->display) + gst_gl_display_activate_gl_context (sink_pad->display, FALSE); } if (mixer_class->reset) mixer_class->reset (mix); @@ -1290,6 +1288,15 @@ gst_gl_mixer_change_state (GstElement * element, GstStateChange transition) g_object_unref (mix->display); mix->display = NULL; } + while (walk) { + GstGLMixerPad *sink_pad = GST_GL_MIXER_PAD (walk->data); + walk = g_slist_next (walk); + if (sink_pad->display) { + gst_gl_display_activate_gl_context (sink_pad->display, TRUE); + g_object_unref (sink_pad->display); + sink_pad->display = NULL; + } + } break; } default: