openlayers / ol-cesium

OpenLayers - Cesium integration
http://openlayers.org/ol-cesium/
BSD 2-Clause "Simplified" License
970 stars 322 forks source link

`SynchronizedOverlay#handlePositionChanged` is called after overlay is destroyed #1152

Closed simonseyock closed 5 months ago

simonseyock commented 5 months ago

EDIT: This is not actually the cause of the problem. See below.

The overlays are not removed from the map. This should be done here I think: https://github.com/openlayers/ol-cesium/blob/bff7a2bb2efa32c0738fbf245666a82513b972fa/src/olcs/OverlaySynchronizer.ts#L100-L105

simonseyock commented 5 months ago

I think I am mistaken here, the overlay should get removed with the clear call. My real problem is that handlePositionChanged of the SynchronizedOverlay is called after destruction. I assume that the handler does not get removed. I investigate.

simonseyock commented 5 months ago

The problem occurs because the listeners on the overlay collection are not removed. I adjust the PR