Ticket #932 (new feature)

Opened 6 years ago

Last modified 4 years ago

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

Reported by: ePeterso2 Owned by: euzuro
Priority: minor Milestone: Future
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

Changed 6 years ago 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)

Changed 6 years ago 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.

Changed 6 years ago by euzuro

  • status changed from closed to reopened
  • resolution wontfix 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. :-)

Changed 6 years ago by euzuro

  • status changed from reopened to new

Changed 5 years ago by crschmidt

  • 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.

Changed 5 years ago by crschmidt

  • milestone changed from 2.7 Release to 2.8 Release

Changed 4 years ago by crschmidt

  • milestone changed from 2.8 Release to 2.9 Release

Moving all tickets which have not been touched since 2.7 out of 2.8.

Changed 4 years ago by crschmidt

  • type changed from bug to feature
  • milestone changed from 2.9 Release to Future

Release manager policy at this point:

  • 2.9 is for tickets which have existing work done on them, or bugs even if they don't.
  • Future is for tickets that no one has done any work on.

If at any time someone decides they are going to work on a ticket, they can pull a ticket back from Future to the current milestone, but putting a ticket in a milestone does not mean anything for its likely release unless it has code available.

Code which has patches ready for review should almost always go into the milestone for the next release.

This is a feature.

Note: See TracTickets for help on using tickets.