[Cogl] [PATCH 2/2] renderer: Don't allow the COGL_DRIVER env var to override application

Robert Bragg robert at sixbynine.org
Thu Jun 27 05:57:49 PDT 2013


This looks good to land to me:

Reviewed-by: Robert Bragg <robert at linux.intel.com>

thanks,
- Robert

On Thu, Jun 27, 2013 at 10:05 AM, Neil Roberts <neil at linux.intel.com> wrote:
> 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.
> ---
>  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 ecbf8bd..33e086c 100644
> --- a/cogl/cogl-renderer.c
> +++ b/cogl/cogl-renderer.c
> @@ -501,8 +501,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)
>      {
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list