From d31a8da8393785962ec43fdfe0cea1af653e7137 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 19 Mar 2012 21:09:43 +0100 Subject: [PATCH] Clone needs a fresh backBuffer and tileQueue. --- lib/OpenLayers/Layer/Grid.js | 3 +++ tests/Layer/Grid.html | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 62a277a2ce..90f553b40b 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -323,6 +323,9 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, { // we do not want to copy reference to grid, so we make a new array obj.grid = []; obj.gridResolution = null; + // same for backbuffer and tile queue + obj.backBuffer = null; + obj.tileQueue = []; return obj; }, diff --git a/tests/Layer/Grid.html b/tests/Layer/Grid.html index 881da6a800..09d5f6bff8 100644 --- a/tests/Layer/Grid.html +++ b/tests/Layer/Grid.html @@ -393,7 +393,7 @@ */ function test_Layer_Grid_clone(t) { - t.plan(5); + t.plan(7); var options = {tileSize: new OpenLayers.Size(500,50)}; var map = new OpenLayers.Map('map', options); @@ -407,6 +407,9 @@ t.ok( clone.grid != layer.grid, "clone does not copy grid"); t.ok( clone.grid.length == 0, "clone creates a new array instead"); + + t.ok(clone.tileQueue !== layer.tileQueue, "new tileQueue for clone"); + t.eq(clone.backBuffer, null, "no backbuffer from original"); t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");