gstglwindow: initialize navigation_loop to NULL
authorJulien Isorce <j.isorce@samsung.com>
Mon, 1 Feb 2016 12:23:32 +0000 (12:23 +0000)
committerJulien Isorce <j.isorce@samsung.com>
Mon, 1 Feb 2016 13:59:22 +0000 (13:59 +0000)
Useful when gst_gl_window.c::gst_gl_window_new is not used.
This is the case when using a custom GstGLWindow.
(ex: GstGLWindowGPUProcess from Chromium)

gst-libs/gst/gl/gstglwindow.c

index b5175f99fa4f05941cdbfc5e6dcb3a1c138fb4ca..695f4c45d332478cd84d343c74db2a7395cf2c10 100644 (file)
@@ -199,6 +199,7 @@ gst_gl_window_init (GstGLWindow * window)
 
   priv->main_context = g_main_context_new ();
   priv->loop = g_main_loop_new (priv->main_context, FALSE);
+  priv->navigation_loop = NULL;
 }
 
 static void
@@ -329,10 +330,12 @@ gst_gl_window_finalize (GObject * object)
   GstGLWindowPrivate *priv = window->priv;
 
   GST_INFO ("quit navigation loop");
-  g_main_loop_quit (window->priv->navigation_loop);
-  /* wait until navigation thread finished */
-  g_thread_join (window->priv->navigation_thread);
-  window->priv->navigation_thread = NULL;
+  if (window->priv->navigation_loop) {
+    g_main_loop_quit (window->priv->navigation_loop);
+    /* wait until navigation thread finished */
+    g_thread_join (window->priv->navigation_thread);
+    window->priv->navigation_thread = NULL;
+  }
 
   if (priv->loop)
     g_main_loop_unref (priv->loop);