From e1947f601a25c044e6d6732396e6f224b9f53969 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Thu, 30 Apr 2015 18:16:46 -0400 Subject: [PATCH] Another DOM leak fix. --- src/js/libpannellum.js | 7 ++++--- src/js/pannellum.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/libpannellum.js b/src/js/libpannellum.js index b970231..d7a7daf 100644 --- a/src/js/libpannellum.js +++ b/src/js/libpannellum.js @@ -148,7 +148,7 @@ function Renderer(container, image, imageType, video) { if (loaded == 6) { fallbackImgSize = this.width; container.appendChild(world); - renderer.image = null; + delete renderer.image; callback(); } }; @@ -288,13 +288,13 @@ function Renderer(container, image, imageType, video) { gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[5]); gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[0]); gl.texImage2D(gl.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image[2]); - this.image = undefined; + delete this.image; } else { // Upload image to the texture gl.texImage2D(glBindType, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, this.image); if (this.video !== true) { // Allow memory to be freed - this.image = undefined; + delete this.image; } } @@ -754,6 +754,7 @@ function Renderer(container, image, imageType, video) { node.image.onload = function() { self.processLoadedTexture(node.image, node.texture); node.textureLoaded = true; + delete node.image; }; node.image.src = node.path + '.' + this.image.extension; } diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 05d334a..12a5f3f 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1054,11 +1054,11 @@ function destroyHotSpots() { current = current.parentNode; } renderContainer.removeChild(current); - config.hotSpots[i].div = null; + delete config.hotSpots[i].div; } } hotspotsCreated = false; - config.hotSpots = undefined; + delete config.hotSpots; } function renderHotSpots() {