From 868bb08efbf29eff1fdea410451eef34cb3182c6 Mon Sep 17 00:00:00 2001 From: Thomas BrĂ¼derli Date: Wed, 5 Sep 2007 14:19:07 +0000 Subject: Remove all object references to prevent memory leaks --- itjs/loader.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'itjs/loader.js') 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 */ } -- cgit v1.2.3