[gtk+/gtk-3-20] gdk: Provide safe fallback for creating GL contexts
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] gdk: Provide safe fallback for creating GL contexts
- Date: Thu, 4 Aug 2016 15:37:27 +0000 (UTC)
commit 6b2a98489284cdd4c10cc9ab550be5e165694066
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon May 23 08:34:39 2016 +0100
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
gdk/gdkwindow.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 66ebb9d..b7f8a96 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]