Only destroy events if they are not already destroyed. This is relevant for controls with obligate controls. Since the map thinks it is in charge of destroying controls, and parent controls also destroy obligate controls, control.destroy ends up getting called twice. If someone wants to change the way this is handled, we should have a standard property that lets the map know that control.destroy is the responsibility of someone else. r=crschmidt (closes #1346)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6230 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -165,8 +165,10 @@ OpenLayers.Control = OpenLayers.Class({
|
|||||||
* to prevent memory leaks.
|
* to prevent memory leaks.
|
||||||
*/
|
*/
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
this.events.destroy();
|
if(this.events) {
|
||||||
this.events = null;
|
this.events.destroy();
|
||||||
|
this.events = null;
|
||||||
|
}
|
||||||
// eliminate circular references
|
// eliminate circular references
|
||||||
if (this.handler) {
|
if (this.handler) {
|
||||||
this.handler.destroy();
|
this.handler.destroy();
|
||||||
|
|||||||
Reference in New Issue
Block a user