[cogl/cogl-1.16] renderer: Don't allow the COGL_DRIVER env var to override application
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/cogl-1.16] renderer: Don't allow the COGL_DRIVER env var to override application
- Date: Fri, 23 Aug 2013 21:21:25 +0000 (UTC)
commit 7bab449700e25e09a6e7e855198814c366293e9d
Author: Neil Roberts <neil linux intel com>
Date: Thu Jun 27 09:57:02 2013 +0100
renderer: Don't allow the COGL_DRIVER env var to override application
Since e07d0fc7441 the COGL_DRIVER environment variable was able to
override the application's driver selection. This doesn't seem like a
good idea because if the application is specifying a driver explicitly
then presumably it can not work with any other driver. This patch
changes it so that if a driver is selected in the configuration and by
the application then they must match, otherwise it will fail with a
CoglError.
Reviewed-by: Robert Bragg <robert linux intel com>
(cherry picked from commit 4e0942d74c8d69aa48e0176bfecf27f64a950d0f)
cogl/cogl-renderer.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 8136fe1..61cda6f 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -505,8 +505,22 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
if (driver_override == COGL_DRIVER_ANY)
invalid_override = driver_name;
}
- else
- driver_override = renderer->driver_override;
+
+ if (renderer->driver_override != COGL_DRIVER_ANY)
+ {
+ if (driver_override != COGL_DRIVER_ANY &&
+ renderer->driver_override != driver_override)
+ {
+ _cogl_set_error (error,
+ COGL_RENDERER_ERROR,
+ COGL_RENDERER_ERROR_BAD_CONSTRAINT,
+ "Application driver selection conflicts with driver "
+ "specified in configuration");
+ return FALSE;
+ }
+
+ driver_override = renderer->driver_override;
+ }
if (driver_override != COGL_DRIVER_ANY)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]