x11/gl: Do not try to call MakeCurrent with a NULL context
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 25 Mar 2015 15:18:44 +0000 (15:18 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 25 Mar 2015 15:18:44 +0000 (15:18 +0000)
This should not happen, but better safe than sorry.

https://bugzilla.gnome.org/show_bug.cgi?id=746746

gdk/x11/gdkglcontext-x11.c

index f7763e3a0a35dc542038cd8da838231f58e48ed8..d9a49fdccb8c056bd46fe450d63fcbda0bdaa1b3 100644 (file)
@@ -1212,6 +1212,12 @@ gdk_x11_display_make_gl_context_current (GdkDisplay   *display,
     }
 
   context_x11 = GDK_X11_GL_CONTEXT (context);
+  if (context_x11->glx_context == NULL)
+    {
+      g_critical ("No GLX context associated to the GdkGLContext; you must "
+                  "call gdk_gl_context_realize() first.");
+      return FALSE;
+    }
 
   GDK_NOTE (OPENGL,
             g_print ("Making GLX context current to drawable %lu\n",