Proper destruction.

This commit is contained in:
ahocevar
2012-06-24 13:41:00 +02:00
parent 2fbb29efa0
commit 7f01528311
3 changed files with 12 additions and 3 deletions
+7
View File
@@ -1,6 +1,8 @@
goog.provide('ol.control'); goog.provide('ol.control');
goog.provide('ol.control.Control'); goog.provide('ol.control.Control');
goog.require('goog.object');
/** /**
* @enum {Object} * @enum {Object}
@@ -76,3 +78,8 @@ ol.control.Control.prototype.deactivate = function() {
this.active_ = true; this.active_ = true;
return returnValue; return returnValue;
}; };
ol.control.Control.prototype.destroy = function() {
this.deactivate();
goog.object.clear(this);
};
+3 -3
View File
@@ -1,8 +1,8 @@
goog.provide('ol.event.Drag'); goog.provide('ol.event.Drag');
goog.require('ol.event.ISequence');
goog.require('ol.event'); goog.require('ol.event');
goog.require('goog.object'); goog.require('ol.event.ISequence');
goog.require('goog.fx.Dragger'); goog.require('goog.fx.Dragger');
goog.require('goog.fx.DragEvent'); goog.require('goog.fx.DragEvent');
goog.require('goog.fx.Dragger.EventType'); goog.require('goog.fx.Dragger.EventType');
@@ -74,7 +74,7 @@ ol.event.Drag = function(target) {
/** @inheritDoc */ /** @inheritDoc */
ol.event.Drag.prototype.destroy = function() { ol.event.Drag.prototype.destroy = function() {
this.dragger_.dispose(); this.dragger_.dispose();
goog.object.clear(this); delete this.dragger_;
}; };
+2
View File
@@ -2,6 +2,7 @@ goog.provide('ol.event.Scroll');
goog.require('ol.event.ISequence'); goog.require('ol.event.ISequence');
goog.require('ol.event'); goog.require('ol.event');
goog.require('goog.events.MouseWheelHandler'); goog.require('goog.events.MouseWheelHandler');
@@ -37,6 +38,7 @@ ol.event.Scroll = function(target) {
/** @inheritDoc */ /** @inheritDoc */
ol.event.Scroll.prototype.destroy = function() { ol.event.Scroll.prototype.destroy = function() {
this.handler_.dispose(); this.handler_.dispose();
delete this.handler_;
}; };