Ticket #2697 (closed bug: duplicate)

Opened 3 years ago

Last modified 2 years ago

Handler.Box: destroy drag handler

Reported by: fredj Owned by:
Priority: trivial Milestone: 2.11 Release
Component: Handler.Box Version: SVN
Keywords: Cc: jcachat, xavier.mamano@…
State:

Description

Handler.Box creates a drag handler but forget to destroy it.

Attachments

2697.0.patch Download (0.6 KB) - added by fredj 3 years ago.
Handler.Box.destroy function

Change History

Changed 3 years ago by fredj

Handler.Box.destroy function

  Changed 3 years ago by fredj

  • state set to Review

  Changed 3 years ago by bartvde

  • state changed from Review to Commit

Looks good fredj, please commit.

  Changed 3 years ago by fredj

  • status changed from new to closed
  • state changed from Commit to Complete
  • resolution set to fixed

(In [10422]) Handler.Box.destroy: destroy the dragHandler. r=bartvde (closes #2697)

follow-up: ↓ 5   Changed 3 years ago by bartvde

I should have spotted that syntax error fredj :-) sorry about that. That's what I get for not running the code.

in reply to: ↑ 4   Changed 3 years ago by fredj

Replying to bartvde:

I should have spotted that syntax error fredj :-) sorry about that. That's what I get for not running the code.

Shame on me ...

  Changed 3 years ago by jcachat

  • status changed from closed to reopened
  • state changed from Complete to Needs More Work
  • resolution fixed deleted

There is a problem with this patch. dragHandler is destroyed and nulled out before calling the base destroy method. If you step through OpenLayers.Handler.prototype.destroy it will eventually call back into Box.deactivate() if the handler was active at the time it was being destroyed. This causes a null exception in Box.deactivate() when it tries to call this.dragHandler.deactivate().

The solution I found was to change Box.destroy() to first call OpenLayers.Handler.prototype.destroy then take care of destroying the dragHandler.

  Changed 3 years ago by jcachat

  • cc jcachat added

I should also mention that I may be experiencing this problem due to the way I am using the controls. I have a panel that contains a Navigation and ZoomBox control. If the ZoomBox control is activated and you use it to zoom to an area, then closing the browser triggers the null reference exception. I just noticed there is an example in the User Recipes section that is doing the same thing (http://openlayers.org/dev/examples/panel.html). If you modify that to use the trunk version of OpenLayers, it will demonstrate the problem.

  Changed 2 years ago by bartvde

  • milestone changed from 2.10 Release to 2.11 Release

Changing milestone to 2.11 otherwise this ticket will not show up (Milestone 2.10 is in the past).

  Changed 2 years ago by jorix

  • cc xavier.mamano@… added

  Changed 2 years ago by fredj

  • status changed from reopened to closed
  • state Needs More Work deleted
  • resolution set to duplicate

see #3003

Note: See TracTickets for help on using tickets.