diff options
author | Thomas BrĂ¼derli | 2007-09-05 14:19:07 +0000 |
---|---|---|
committer | Thomas BrĂ¼derli | 2007-09-05 14:19:07 +0000 |
commit | 868bb08efbf29eff1fdea410451eef34cb3182c6 (patch) | |
tree | a43fed8997eee19ed1c85291bd30d3b83de47178 | |
parent | 4b113af0a107d2261ca7b7cbd0d444b7607251e4 (diff) | |
download | itools-868bb08efbf29eff1fdea410451eef34cb3182c6.tar.gz itools-868bb08efbf29eff1fdea410451eef34cb3182c6.tar.bz2 itools-868bb08efbf29eff1fdea410451eef34cb3182c6.zip |
Remove all object references to prevent memory leaks
-rw-r--r-- | itjs/loader.js | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/itjs/loader.js b/itjs/loader.js index 0208d5a..91f280d 100644 --- a/itjs/loader.js +++ b/itjs/loader.js @@ -51,7 +51,7 @@ load: function(baseurl, pos, num, query_volatile, retry) this.num = num; this.query_volatile = query_volatile; - if (this.loader && this.loader.stop) + if (this.loader) this.stop(); while ((num > 0) && this.entry[pos]) @@ -230,11 +230,7 @@ dataReady: function(data, callid) this.load(this.baseurl, this.end, this.pos + this.num - this.end); } - if (this.scrpt) - { - document.body.removeChild(this.scrpt); - this.scrpt = null; - } + this.unlink(); }, stop: function() @@ -245,7 +241,22 @@ stop: function() } catch (e) { } - this.loader = null; + this.unlink(); +}, + +unlink: function() +{ + if (it_loader['__inst'+this.instance]) + it_loader['__inst'+this.instance] = null; + + if (this.loader) + this.loader = null; + + if (this.scrpt) + { + document.body.removeChild(this.scrpt); + this.scrpt = null; + } }/* NO COMMA */ } |