[OpenLayers-Dev] removeExcessTiles doesn't work properly

kikuchan at uranus.dti.ne.jp kikuchan at uranus.dti.ne.jp
Wed May 23 17:56:25 EDT 2012

Hi list.

I've found a potential bug in OpenLayers.Layer.Grid class
when I'm trying to make a subclass of the class.

A function removeExcessTiles() doesn't work properly in following situation:

1. initGriddedTiles() founds minRows and minCols are 1, 3
2. then grid will be [[a, b, c]] for example.
3. next time of calling initGriddedTiles founds minRows and minCols are 2, 2
4. then grid will be [[a, b, c], [d, e]] after the do-while.
5. removeExcessTiles(2, 2) eliminate 'c', AND 'e' objects.
  (because it uses 'pop' for each rows)
6. tileData[i].tile.draw() refers destroy()ed data, and it crashes.

I've attached a tiny patch to fix it.

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Grid.patch
Type: application/octet-stream
Size: 659 bytes
Desc: Grid.patch
Url : http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120524/16b53a35/Grid.obj

More information about the Dev mailing list