From 0dcbde2018e22323492d48ac9d7db39ab3e9a9df Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 17 Mar 2014 17:52:09 +0100 Subject: [PATCH] Bump minimum lgi dependency to 0.7.0 Before commit 1b2826 in lgi, the get_rgba() function on cairo SolidPatterns was specified like this: get_rgba = { ret = cairo.Status, { ti.double, dir = 'out' }, { ti.double, dir = 'out' }, { ti.double, dir = 'out' } }, The above commit fixed this (without saying so) and the code became: get_rgba = { ret = cairo.Status, { ti.double, dir = 'out' }, { ti.double, dir = 'out' }, { ti.double, dir = 'out' }, { ti.double, dir = 'out' } }, The prototype for the corresponding cairo function is: cairo_public cairo_status_t cairo_pattern_get_rgba (cairo_pattern_t *pattern, double *red, double *green, double *blue, double *alpha); As you see, this functions gets four double* as arguments and it will save its result via those pointers. Old versions of lgi call this function with too few arguments and this will cause a segmentation fault when cairo dereferences an invalid pointer. Signed-off-by: Uli Schlachter --- build-utils/lgi-check.sh | 3 ++- lib/gears/surface.lua.in | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build-utils/lgi-check.sh b/build-utils/lgi-check.sh index 340eea92f..96bab2901 100755 --- a/build-utils/lgi-check.sh +++ b/build-utils/lgi-check.sh @@ -25,7 +25,8 @@ die() lua -e 'require("lgi")' || die # Check the version number -lua -e 'if tonumber(string.match(require("lgi.version"), "(%d%.%d)")) <= 0.5 then error("lgi too old, need at least version 0.6.1") end' || die +# Keep this in sync with lib/gears/surface.lua.in! +lua -e 'if tonumber(string.match(require("lgi.version"), "(%d%.%d)")) < 0.7 then error("lgi too old, need at least version 0.7.0") end' || die # Check for the needed gi files lua -e 'l = require("lgi") assert(l.cairo, l.Pango, l.PangoCairo)' || die diff --git a/lib/gears/surface.lua.in b/lib/gears/surface.lua.in index 7ad9e1f3b..023703fd1 100644 --- a/lib/gears/surface.lua.in +++ b/lib/gears/surface.lua.in @@ -9,11 +9,10 @@ local type = type local capi = { awesome = awesome } local cairo = require("lgi").cairo --- This checks for '<= 0.5' because there are git versions after 0.6 which still --- identify themselves as 0.6 but already have the needed cairo support -local ver_major,ver_minor = string.match(require('lgi.version'),'(%d)%.(%d)') -if ( (tonumber(ver_major)<=0) and (tonumber(ver_minor)<=5) ) then - error("lgi too old, need at least version 0.6.1") +-- Keep this in sync with build-utils/lgi-check.sh! +local ver_major, ver_minor = string.match(require('lgi.version'), '(%d)%.(%d)') +if tonumber(ver_major) <= 0 and tonumber(ver_minor) < 7 then + error("lgi too old, need at least version 0.7.0") end -- gears.surface