summaryrefslogtreecommitdiffstats
path: root/src/image.js
diff options
context:
space:
mode:
authorNenad Kuzmanovic <kuzma86@gmail.com>2018-02-07 21:02:46 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-02-07 21:02:46 +0100
commit750b8d124a24caecea571be5b474274373695a6f (patch)
tree31000da11d371e2acb423c28fca2bd7310575bd0 /src/image.js
parentf16e4708b6cf0bf9ed939f3fd169776f67f8e0b1 (diff)
downloadsvg.js-750b8d124a24caecea571be5b474274373695a6f.tar.gz
svg.js-750b8d124a24caecea571be5b474274373695a6f.zip
#805 Image memory leak fix (#806)
Simple sulution with SVG.off() in callback
Diffstat (limited to 'src/image.js')
-rwxr-xr-x[-rw-r--r--]src/image.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/image.js b/src/image.js
index feb369e..02bfb11 100644..100755
--- a/src/image.js
+++ b/src/image.js
@@ -16,6 +16,8 @@ SVG.Image = SVG.invent({
// preload image
SVG.on(img, 'load', function() {
+ SVG.off(img)
+
var p = self.parent(SVG.Pattern)
if(p === null) return
@@ -39,6 +41,8 @@ SVG.Image = SVG.invent({
})
SVG.on(img, 'error', function(e){
+ SVG.off(img)
+
if (typeof self._error === 'function'){
self._error.call(self, e)
}