From 7b3c65bac13c93474b934de10f542a5e64fe092f Mon Sep 17 00:00:00 2001 From: aki Date: Thu, 9 Jul 2015 11:35:12 +0900 Subject: [PATCH] Fix leak minimap --- lib/minimap-element.coffee | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index 713830c1..b17acb18 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -149,6 +149,7 @@ class MinimapElement extends HTMLElement destroy: -> @subscriptions.dispose() @detach() + @minimap = null # ###### ####### ## ## ######## ######## ## ## ######## # ## ## ## ## ### ## ## ## ### ## ## @@ -326,7 +327,7 @@ class MinimapElement extends HTMLElement # Internal: Performs the actual {MinimapElement} update. update: -> - return unless @attached and @isVisible() and not @minimap.isDestroyed() + return unless @attached and @isVisible() and @minimap? if @adjustToSoftWrap and @marginRight? @style.marginRight = @marginRight + 'px' @@ -516,7 +517,7 @@ class MinimapElement extends HTMLElement startDrag: ({which, pageY}) -> # if which is 2 # @middleMousePressedOverCanvas({pageY}) - return if @minimap.isDestroyed() + return unless @minimap return if which isnt 1 and which isnt 2 {top} = @visibleArea.getBoundingClientRect() {top: offsetTop} = @getBoundingClientRect() @@ -546,7 +547,7 @@ class MinimapElement extends HTMLElement # offsetTop - The {MinimapElement} offset at the moment of the # drag start. drag: (e, initial) -> - return if @minimap.isDestroyed() + return unless @minimap return if e.which isnt 1 and e.which isnt 2 y = e.pageY - initial.offsetTop - initial.dragOffset @@ -563,7 +564,7 @@ class MinimapElement extends HTMLElement # offsetTop - The {MinimapElement} offset at the moment of the # drag start. endDrag: (e, initial) -> - return if @minimap.isDestroyed() + return unless @minimap @dragSubscription.dispose() # ###### ###### ######