[gtk+] gdk: Provide safe fallback for creating GL contexts
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Provide safe fallback for creating GL contexts
- Date: Mon, 23 May 2016 07:54:09 +0000 (UTC)
commit 9c3802fc4b630c4ca404194b62b1178d51bc331f
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 7625e47..d82f8ca 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]