Skip to content

Commit

Permalink
Fix leak minimap
Browse files Browse the repository at this point in the history
  • Loading branch information
aki77 committed Jul 9, 2015
1 parent 882ae3d commit 7b3c65b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class MinimapElement extends HTMLElement
destroy: ->
@subscriptions.dispose()
@detach()
@minimap = null

# ###### ####### ## ## ######## ######## ## ## ########
# ## ## ## ## ### ## ## ## ### ## ##
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand All @@ -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()

# ###### ###### ######
Expand Down

0 comments on commit 7b3c65b

Please sign in to comment.