mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Ensure we don't try to draw a destroyed selection on editor refresh
Destroying the cursor will cause a redraw, which causes a problem when we execute it synchronously in specs because destroying the cursor also destroys the marker associated with the selection. Here we remove the selection first to avoid this problem.
This commit is contained in:
@@ -20,11 +20,11 @@ class Selection
|
||||
@destroy()
|
||||
|
||||
destroy: ->
|
||||
if @cursor
|
||||
@cursor.off('.selection')
|
||||
@cursor.destroy()
|
||||
return if @destroyed
|
||||
@destroyed = true
|
||||
@editSession.removeSelection(this)
|
||||
@trigger 'destroyed'
|
||||
@cursor?.destroy()
|
||||
|
||||
finalize: ->
|
||||
@initialScreenRange = null unless @initialScreenRange?.isEqual(@getScreenRange())
|
||||
|
||||
Reference in New Issue
Block a user