Some memory leaks have been fixed (#61)

* svg.selectize.js memory leaks have been fixed
main
Boris Sekachev 8 years ago committed by Nikita Manovich
parent 05e6e331d2
commit badddeb07f

@ -1,17 +1,17 @@
From b89380c65ea8bc9231cc98a6ae0e812227c85b3d Mon Sep 17 00:00:00 2001 From 5eeb1092c64865c555671ed585da18f974c9c10c Mon Sep 17 00:00:00 2001
From: Boris Sekachev <boris.sekachev@intel.com> From: Boris Sekachev <boris.sekachev@intel.com>
Date: Tue, 10 Jul 2018 14:31:13 +0300 Date: Tue, 18 Sep 2018 15:58:20 +0300
Subject: [PATCH] tmp Subject: [PATCH] tmp
--- ---
.../engine/static/engine/js/3rdparty/svg.draggable.js | 1 + .../engine/static/engine/js/3rdparty/svg.draggable.js | 1 +
cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js | 17 +++++++++++++++-- cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js | 17 +++++++++++++++--
.../apps/engine/static/engine/js/3rdparty/svg.resize.js | 5 +++-- .../apps/engine/static/engine/js/3rdparty/svg.resize.js | 5 +++--
.../apps/engine/static/engine/js/3rdparty/svg.select.js | 1 + .../apps/engine/static/engine/js/3rdparty/svg.select.js | 5 ++++-
4 files changed, 20 insertions(+), 4 deletions(-) 4 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
index d88abf5..06158f1 100644 index d88abf5..aba474c 100644
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js --- a/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js +++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.draggable.js
@@ -109,6 +109,7 @@ @@ -109,6 +109,7 @@
@ -23,7 +23,7 @@ index d88abf5..06158f1 100644
var box = this.getBBox() var box = this.getBBox()
, p = this.transformPoint(e) , p = this.transformPoint(e)
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js
index 68dbf2a..9884b75 100644 index 68dbf2a..20a6917 100644
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js --- a/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js +++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.draw.js
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
@ -101,7 +101,7 @@ index 0c3b63d..fb5dc26 100644
// Calculate the difference between the mouseposition at start and now // Calculate the difference between the mouseposition at start and now
var txPt = this._extractPosition(event); var txPt = this._extractPosition(event);
diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js diff --git a/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js b/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js
index 47e07bd..f1d0c02 100644 index 47e07bd..cee6d34 100644
--- a/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js --- a/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js
+++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js +++ b/cvat/apps/engine/static/engine/js/3rdparty/svg.select.js
@@ -160,6 +160,7 @@ SelectHandler.prototype.drawPoints = function () { @@ -160,6 +160,7 @@ SelectHandler.prototype.drawPoints = function () {
@ -112,6 +112,32 @@ index 47e07bd..f1d0c02 100644
var x = ev.pageX || ev.touches[0].pageX; var x = ev.pageX || ev.touches[0].pageX;
var y = ev.pageY || ev.touches[0].pageY; var y = ev.pageY || ev.touches[0].pageY;
_this.el.fire('point', {x: x, y: y, i: k, event: ev}); _this.el.fire('point', {x: x, y: y, i: k, event: ev});
@@ -361,6 +362,7 @@ SelectHandler.prototype.cleanup = function () {
// stop watching the element, remove the selection
this.rectSelection.set.each(function () {
this.remove();
+ SVG.off(this.node);
});
this.rectSelection.set.clear();
@@ -371,6 +373,7 @@ SelectHandler.prototype.cleanup = function () {
// Remove all points, clear the set, stop watching the element
this.pointSelection.set.each(function () {
this.remove();
+ SVG.off(this.node);
});
this.pointSelection.set.clear();
@@ -379,8 +382,8 @@ SelectHandler.prototype.cleanup = function () {
if (!this.pointSelection.isSelected && !this.rectSelection.isSelected) {
this.nested.remove();
+ SVG.off(this.node);
delete this.nested;
-
}
};
-- --
2.7.4 2.7.4

@ -44,6 +44,8 @@ class FrameProvider extends Listener {
this._loaded = frame; this._loaded = frame;
this._frameCollection[frame] = image; this._frameCollection[frame] = image;
this._loadAllowed = true; this._loadAllowed = true;
image.onload = null;
image.onerror = null;
this.notify(); this.notify();
} }
@ -109,6 +111,8 @@ class FrameProvider extends Listener {
image.onload = this._onImageLoad.bind(this, image, frame); image.onload = this._onImageLoad.bind(this, image, frame);
image.onerror = () => { image.onerror = () => {
this._loadAllowed = true; this._loadAllowed = true;
image.onload = null;
image.onerror = null;
}; };
image.src = `get/task/${this._tid}/frame/${frame}`; image.src = `get/task/${this._tid}/frame/${frame}`;
}.bind(this), 25); }.bind(this), 25);

@ -1608,8 +1608,8 @@ class ShapeView extends Listener {
_removeShapeUI() { _removeShapeUI() {
if (this._uis.shape) { if (this._uis.shape) {
this._uis.shape.off('click');
this._uis.shape.remove(); this._uis.shape.remove();
SVG.off(this._uis.shape.node);
this._uis.shape = null; this._uis.shape = null;
} }
} }
@ -1618,6 +1618,7 @@ class ShapeView extends Listener {
_removeShapeText() { _removeShapeText() {
if (this._uis.text) { if (this._uis.text) {
this._uis.text.remove(); this._uis.text.remove();
SVG.off(this._uis.text.node);
this._uis.text = null; this._uis.text = null;
} }
} }

Loading…
Cancel
Save