Commit 9c3802fc authored by Emmanuele Bassi's avatar Emmanuele Bassi

gdk: Provide safe fallback for creating GL contexts

If the backend does not override GdkWindowClass.create_gl_context()
then we should provide a fallback that gives an error, instead of
crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=766782
parent fe684078
......@@ -2769,11 +2769,20 @@ gdk_window_get_paint_gl_context (GdkWindow *window,
if (window->impl_window->gl_paint_context == NULL)
{
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (impl_class->create_gl_context == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("The current backend does not support OpenGL"));
return NULL;
}
window->impl_window->gl_paint_context =
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window->impl_window,
TRUE,
NULL,
&internal_error);
impl_class->create_gl_context (window->impl_window,
TRUE,
NULL,
&internal_error);
}
if (internal_error != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment