From fbfef7e62afa32f95c6d8e97aba6f13ab3493332 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 8 Jan 2020 23:43:15 +0100 Subject: Drawable.c: fix logic broken by scope cleanup xp must be declared outside the while loop! xp was reset in each interation despite being increased at the iteration's end! To protect against this happening again replace the while loop by a for loop that references xp. Bug introduced by d94f472744355c71987d145727aecace1e8455b6 --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 199f01cd8..7f1d2dec5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -2261,11 +2261,11 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, { RegionPtr pRegion = RegionCreate(NullBox, 1); - int np = nPoints; - while (np--) + xPoint *xp = pPoints; + + for (int np = nPoints; np--; xp++) { BoxRec box; - xPoint *xp = pPoints; if (CoordModePrevious) { @@ -2294,8 +2294,6 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, RegionUnion(pRegion, pRegion, &tmpRegion); RegionUninit(&tmpRegion); - - xp++; } BoxRec extents = *RegionExtents(pRegion); -- cgit v1.2.3