[OpenLayers-Users] layer.div is null?

Jeff Dege jdege at korterra.com
Thu Nov 1 17:13:55 EDT 2007


 With continued experience with this, I've found that the vector layer
that is causing the problem is the one that is created in
OpenLayers.Handler.Point.activate().  It seems to being destroyed twice,
in some situation that I've not been able to replicate on demand.

> -----Original Message-----
> From: users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org] On Behalf Of Jeff Dege
> Sent: Monday, October 29, 2007 4:57 PM
> To: users at openlayers.org
> Subject: [OpenLayers-Users] layer.div is null?
> 
> I'm getting occassional, unreproducable errors, in Map.destroy().
> 
> This is in 2.3-rc3
> 
> Among other things, Map.destroy() loops through all the controls that
> have been added to the map, and calls destroy() on each.
> 
> Control.destroy() looks through all the handlers that have 
> been set for
> the control, and calls destroy() on them.
> 
> Handler.destroy() calls this.deactivate(), which calls
> this.map.removeLayer(this.layer, false);
> 
> And Map.removeLayer() then calls
> this.layerContainerDiv.removeChild(layer.div).
> 
> The problem is that by the time we get there, layer.div is sometimes
> null, which throws an exception.
> 
> Any ideas as to why this might be happening?
> 
> Would there be any consequences to adding a guard test?  
> 
> Changing this:
> 
>    if (layer.isFixed) {
>       this.viewPortDiv.removeChild(layer.div);
>    } else {
>       this.layerContainerDiv.removeChild(layer.div);
>    }
> 
> to:
> 
>    if (layer.div != null) {
>       if (layer.isFixed) {
>          this.viewPortDiv.removeChild(layer.div);
>       } else {
>          this.layerContainerDiv.removeChild(layer.div);
>       }
>    }
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 



More information about the Users mailing list