[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#909015: abiword: Crashes on startup with GLib-ERROR



Control: reassign 909015 libcogl20 1.22.2-2
Control: affects 909015 abiword

Dear Maintainer,
this crash seems to be caused by a broken opengl configuration.
It could still be seen with buster when e.g. someone has the
nvidia-driver-libs-nonglvnd installed without the kernel module loaded.

Unfortunately there is no output at stdout that would point
the user to that direction. Instead the application just crashes.

With attached patch the cogl initialization would at least just fail and
clutter could write an error message to stdout.
  Unable to initialize Clutter: Unable to initialize the Clutter backend: no available drivers found.

Kind regards,
Bernhard
From 338a1c3c8a10c4e28cadf96e0ce76d933ede625d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu@mailbox.org>
Date: Tue, 11 Dec 2018 18:25:59 +0100
Subject: [PATCH] Fail gracefully when no usable device is found.

Debian-Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909015
---
 cogl/cogl-context.c                    |  2 +-
 cogl/driver/gl/gles/cogl-driver-gles.c | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index a7eed29..9503561 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -679,7 +679,7 @@ _cogl_context_get_gl_extensions (CoglContext *context)
 #ifdef HAVE_COGL_GL
   if (context->driver == COGL_DRIVER_GL3)
     {
-      int num_extensions, i;
+      int num_extensions = 0, i;
 
       context->glGetIntegerv (GL_NUM_EXTENSIONS, &num_extensions);
 
diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
index e94449f..7ef375a 100644
--- a/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -238,6 +238,23 @@ _cogl_get_gl_version (CoglContext *ctx,
                                          minor_out);
 }
 
+static CoglBool
+check_gl_version (CoglContext *ctx,
+                  char **gl_extensions,
+                  CoglError **error)
+{
+  if (!_cogl_context_get_gl_version (ctx))
+    {
+      _cogl_set_error (error,
+                   COGL_DRIVER_ERROR,
+                   COGL_DRIVER_ERROR_UNKNOWN_VERSION,
+                   "The GLES version could not be determined");
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
 static CoglBool
 _cogl_driver_update_features (CoglContext *context,
                               CoglError **error)
@@ -259,6 +276,9 @@ _cogl_driver_update_features (CoglContext *context,
 
   gl_extensions = _cogl_context_get_gl_extensions (context);
 
+  if (!check_gl_version (context, gl_extensions, error))
+    return FALSE;
+
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WINSYS)))
     {
       char *all_extensions = g_strjoinv (" ", gl_extensions);
-- 
2.19.2


Reply to: