Ticket #1107 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

handlers have to check if layer exists before destroying it

Reported by: pgiraud Owned by:
Priority: minor Milestone: 2.6 Release
Component: general Version: 2.5
Keywords: Cc:
State:

Description

Handler.Point and Handler.RegularPolygon deal with a layer and in some cases they try to call removeLayer() or destroy() even if it is already destroyed. This happens for example when the map is destroyed.

Handlers should check if layer is destroyed.

In the same way, I also remove the call to removeLayer as the destroy method already do this.

Patch (with tests !) forthcoming.

Attachments

handler.deactivate.patch Download (3.3 KB) - added by pgiraud 6 years ago.
patch with tests
patch-1107-A0.diff Download (4.0 KB) - added by elemoine 6 years ago.
Pierre's patch + comments added

Change History

Changed 6 years ago by pgiraud

patch with tests

  Changed 6 years ago by pgiraud

  • keywords review added

please review

  Changed 6 years ago by pgiraud

  • type changed from feature to bug

follow-up: ↓ 4   Changed 6 years ago by pgiraud

I can confirm that all tests pass on IE6 win and FF linux.

in reply to: ↑ 3   Changed 6 years ago by elemoine

Replying to pgiraud:

I can confirm that all tests pass on IE6 win and FF linux.

I'm in favour for this patch.

Just one comment though: you use layer.map to check whether the layer was destroyed or not. Rigorously, layer.map == null doesn't mean that the layer was destroyed, it means that the layer isn't added to the map. In the Handler.Point and Handler.RegularPolygon cases, we're assured that the layer was destroyed if layer.map is null bause the handlers themselves call addLayer(). For other cases, I think we should introduce a destroyed property and possibly a isDestroyed() method to the Layer class.

Changed 6 years ago by elemoine

Pierre's patch + comments added

  Changed 6 years ago by elemoine

  • keywords review removed
  • status changed from new to closed
  • resolution set to fixed

(In [5085]) handlers have to check if layer exists before destroying it. Thanks pgiraud. (closes #1107)

Note: See TracTickets for help on using tickets.