OpenLayers OpenLayers

Ticket #932 (new bug)

Opened 1 year ago

Last modified 1 month ago

OpenLayers.Marker.destroy() does not call removeMarker(

Reported by: ePeterso2 Assigned to: euzuro
Priority: minor Milestone: 2.8 Release
Component: Marker Version: 2.4
Keywords: marker destroy removeMarker Cc:
State:

Description

I had assumed that when a Marker's destroy() method was called that the marker would be removed from any layer to which it had been added via addMarker(). What I found is that calling destroy() without first calling removeMarker() causes much broken behavior that varies depending upon the browser. Symptoms include:

- Marker icons still appearing on the map (IE6)

- Popups associated with markers not being displayed (FF2)

- "this.icon has no properties", originating from OpenLayers.Icon.draw() while trying to draw an icon associated with a destroyed marker

Shouldn't Marker.destroy() call Layer.removeMarker() if the marker is associated with a layer?

Change History

08/27/07 13:28:13 changed by crschmidt

(In [4058]) Documentation for Marker.destroy: We can't actually remove the marker from the layer because we don't have a reference to the layer, but this isn't adequately documented in the Marker.destroy api docs. (See #932)

08/27/07 13:29:10 changed by crschmidt

  • status changed from new to closed.
  • resolution set to wontfix.

Markers don't know what layer they are attached to. This means that there is no way to remove the marker from the layer *from the marker* -- that has to be done by your application first.

However, this is not adequately documented in the Marker class: I've changed that so that this is at least written down.

Sorry that this bit you.

08/28/07 04:16:51 changed by euzuro

  • status changed from closed to reopened.
  • resolution deleted.
  • milestone changed from 2.5 Release to 2.6 Release.

Good call on adding the new documentation.

I think, however, that the real solution to this would be to give the marker a reference to its layer so that it can do the right thing when being destroyed.

When you destroy() something, you want it to go completely away.

I'm reopening this ticket and sliding it into 2.6. I'll make the patch for this next round. :-)

08/28/07 04:19:04 changed by euzuro

  • status changed from reopened to new.

01/22/08 17:40:58 changed by crschmidt

  • state changed.
  • milestone changed from 2.6 Release to 2.7 Release.

Mass ticket move to 2.7 post dev meeting. If you are actively working on this task, please update this ticket with information and change the milestone to 2.6. At the time of the next IRC meeting (most likely 1-31-08), this will mean the ticket can *not* be brought back into 2.6 unless there is further feedback.

07/28/08 12:47:27 changed by crschmidt

  • milestone changed from 2.7 Release to 2.8 Release.