openlayers/openlayers — pull request #805 by mosesonline (2012-12-18 09:13:57+00:00)
Title: unselectAll on removing layer fix

When removing layer (OL.Layer.Vector) which is used SelectedFeature and set layer of the control in a preremovelayer listener to a new layer a layer.selectFeatures is null exception occures, because selectFeatures is set to null before the destroy method of the parent class of OL.Layer.Vector is called which triggers preremovelayer.
An other solution would be to pull the setting to null of the attributes after the parents destroy but then the attributes would not be null on removelayer, which as problematic as the code now. Not calling parents destroy would lead to redundant code. One other solution could be a silent option and this should be passed to the removeLayer of map class, but then the events has to be triggered by the layer which is not the responsibility.