A side effect of #61 which introduced default attributions derived from the styles is that the attribution becomes "sticky" and never goes away even if you switch to a different layer - this happens even if you're using a statically configured custom attribution.
The way attribution normally works in leaflet is that the attribution control registers a layeradd handler that calls getAttribution on the layer and adds the result to current attribution. The handler also registers a one short remove handler to remove the attribution again.
The control then tracks active attributions using a dictionary keyed by the attribution text and with a reference count as the value so an attribution will only be remove once it's reference count falls to zero.
That all works with #61 just fine, but it also registers a load event handler on the GL map that calls getAttribution and adds the result to the attribution control, resulting in an additional reference that will never be released.
If custom attribution text in in use then that additional add just winds up adding an extra reference to the same attribution and could just be skipped entirely.
More complicated is the case of a dynamically generated attribution as I believe the whole point of the load handler is that the attribution might have changed, but it probably needs to remove the old version and then add the new version - the normal remove handler should then take care of removing the last reference as normal.
A side effect of #61 which introduced default attributions derived from the styles is that the attribution becomes "sticky" and never goes away even if you switch to a different layer - this happens even if you're using a statically configured custom attribution.
The way attribution normally works in leaflet is that the attribution control registers a
layeraddhandler that callsgetAttributionon the layer and adds the result to current attribution. The handler also registers a one shortremovehandler to remove the attribution again.The control then tracks active attributions using a dictionary keyed by the attribution text and with a reference count as the value so an attribution will only be remove once it's reference count falls to zero.
That all works with #61 just fine, but it also registers a
loadevent handler on the GL map that callsgetAttributionand adds the result to the attribution control, resulting in an additional reference that will never be released.If custom attribution text in in use then that additional add just winds up adding an extra reference to the same attribution and could just be skipped entirely.
More complicated is the case of a dynamically generated attribution as I believe the whole point of the load handler is that the attribution might have changed, but it probably needs to remove the old version and then add the new version - the normal remove handler should then take care of removing the last reference as normal.