summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2007-09-05 14:19:07 +0000
committerThomas BrĂ¼derli2007-09-05 14:19:07 +0000
commit868bb08efbf29eff1fdea410451eef34cb3182c6 (patch)
treea43fed8997eee19ed1c85291bd30d3b83de47178
parent4b113af0a107d2261ca7b7cbd0d444b7607251e4 (diff)
downloaditools-868bb08efbf29eff1fdea410451eef34cb3182c6.tar.gz
itools-868bb08efbf29eff1fdea410451eef34cb3182c6.tar.bz2
itools-868bb08efbf29eff1fdea410451eef34cb3182c6.zip
Remove all object references to prevent memory leaks
-rw-r--r--itjs/loader.js25
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 */
}