[OpenLayers-Users] Reverting to pan/zoom after feature insertion

Eric Lemoine eric.c2c at gmail.com
Wed Dec 19 14:52:47 EST 2007


On Dec 19, 2007 3:51 PM, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Wed, Dec 19, 2007 at 01:06:34PM +0100, Eric Lemoine wrote:
> > Does the problem exist on the OpenLayers examples (for example
> > <http://openlayers.org/dev/examples/modify-feature.html>)? I haven't
> > been able to reproduce here.
>
> If you are *currently* in the process of drawing a new feature, and you
> refresh the page, then the Map.destroy function which is called on page
> onunload loops through the controls and destroys them. The Control calls
> the Handler destroy, which calls the handler deactivate() method, which
> (in the Point handler) calls the this.cancel() if drawing is true, which
> then calls this.layer.renderer.clear()...
>
> ... But because the controls are destroyed *after* the layers in the map
> destroy() function, the layer has already been destroyed, and it has no
> renderer property, which means that IE throws an error.
>
> I can reproduce this in IE7. Someone should file this as a bug, and we
> should write a test for it. The test should look like:
>
>   var handler = new OpenLayers.Handler.Point();
>   handler.activate();
>   handler.layer.destroy();
>   handler.deactivate();
>
> Though in a quick test inside Firebug lite, new OpenLayers.Handler()
> returns undefined, so I'm probably missing something more important.
>
> This should be a blocker for 2.6.

<http://trac.openlayers.org/ticket/1222>

--
Eric



More information about the Users mailing list