Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #936 from atom/fix-retained-editor-references
Browse files Browse the repository at this point in the history
Remove editor from watchedEditors when editor is destroyed
  • Loading branch information
leroix committed Dec 8, 2017
2 parents b1dcef9 + 0caa1d2 commit cbe2ac5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/autocomplete-manager.js
Expand Up @@ -179,13 +179,18 @@ class AutocompleteManager {
this.subscriptions.add(disposable)
return new Disposable(() => {
disposable.dispose()
this.subscriptions.remove(disposable)
if (this.subscriptions != null) {
this.subscriptions.remove(disposable)
}
this.watchedEditors.delete(editor)
})
}

handleEvents () {
this.subscriptions.add(atom.workspace.observeTextEditors((editor) => { this.watchEditor(editor, ['workspace-center']) }))
this.subscriptions.add(atom.workspace.observeTextEditors((editor) => {
const disposable = this.watchEditor(editor, ['workspace-center'])
editor.onDidDestroy(() => disposable.dispose())
}))

// Watch config values
this.subscriptions.add(atom.config.observe('autosave.enabled', (value) => { this.autosaveEnabled = value }))
Expand Down

0 comments on commit cbe2ac5

Please sign in to comment.