diff --git a/src/tiledimage.js b/src/tiledimage.js index 347a5b3e..cc05cb57 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -326,6 +326,10 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag */ destroy: function() { this.reset(); + + if (this.source.destroy) { + this.source.destroy(); + } }, /** diff --git a/src/viewer.js b/src/viewer.js index 93217150..20e06186 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -742,11 +742,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, return; } - //TODO: implement destroy and _freeupCanvasMemory method for all child classes of TileSource, then remove if statement wrap below. - if (this.source.destroy) { - this.source.destroy(); - } - this.close(); this.clearOverlays();