From 160fad22c035a17853927e6853863d39a2b24b5e Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Fri, 11 Oct 2013 16:00:23 +0100 Subject: [PATCH] [825/906] glwindow_x11: check if the loop exists It happens when calling set_window_handle before to reach GST_STATE_READY. In this case the parent is set when creating the internal window. --- gst-libs/gst/gl/x11/gstglwindow_x11.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 3a79aa3..705fe72 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -355,7 +355,8 @@ gst_gl_window_x11_close (GstGLWindow * window) g_source_unref (window_x11->x11_source); window_x11->x11_source = NULL; g_main_loop_unref (window_x11->loop); - window_x11->loop = NULL, g_main_context_unref (window_x11->main_context); + window_x11->loop = NULL; + g_main_context_unref (window_x11->main_context); window_x11->main_context = NULL; window_x11->running = FALSE; @@ -414,7 +415,11 @@ gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id) window_x11->parent_win = (Window) id; - if (g_main_loop_is_running (window_x11->loop)) { + /* The loop may not exist yet because it's created in GstGLWindow::open + * which is only called when going from READY to PAUSED state. + * If no loop then the parent is directly set in XCreateWindow + */ + if (window_x11->loop && g_main_loop_is_running (window_x11->loop)) { GST_LOG ("set parent window id: %lud", id); g_mutex_lock (&window_x11->disp_send_lock); -- 2.7.4