xf86-video-intel: tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Sep 1 08:53:11 PDT 2013


 tools/virtual.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 3f03cafcb5f1a5b5a23006ced78a4db5ff6659fb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Sep 1 16:50:22 2013 +0100

    intel-virtual-output: Refer to the new memory block after realloc
    
    When updating pointers to point into the new memory block after a
    realloc, it helps to pass the new locations around rather than the old.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index e2654ff..a37f4ca 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -1585,7 +1585,7 @@ static void display_init_randr_hpd(struct display *display)
 		XRRSelectInput(display->dpy, display->root, RROutputChangeNotifyMask);
 }
 
-static void rebuild_clones(struct context *ctx)
+static void rebuild_clones(struct context *ctx, struct clone *new_clones)
 {
 	int n, m;
 
@@ -1594,7 +1594,7 @@ static void rebuild_clones(struct context *ctx)
 
 		d->clone = NULL;
 		for (m = 0; m < ctx->nclone; m++) {
-			struct clone *c = &ctx->clones[m];
+			struct clone *c = &new_clones[m];
 
 			if (c->dst.display != d)
 				continue;
@@ -1603,6 +1603,8 @@ static void rebuild_clones(struct context *ctx)
 			d->clone = c;
 		}
 	}
+
+	ctx->clones = new_clones;
 }
 
 static struct clone *add_clone(struct context *ctx)
@@ -1615,9 +1617,7 @@ static struct clone *add_clone(struct context *ctx)
 			return NULL;
 
 		if (new_clones != ctx->clones)
-			rebuild_clones(ctx);
-
-		ctx->clones = new_clones;
+			rebuild_clones(ctx, new_clones);
 	}
 
 	return memset(&ctx->clones[ctx->nclone++], 0, sizeof(struct clone));


More information about the xorg-commit mailing list