From 7bab449700e25e09a6e7e855198814c366293e9d Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 27 Jun 2013 09:57:02 +0100 Subject: [PATCH] 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 (cherry picked from commit 4e0942d74c8d69aa48e0176bfecf27f64a950d0f) --- cogl/cogl-renderer.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c index 8136fe1e8..61cda6ff6 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) {