Add buffer subscriptions to repo's subscriptions

Closes #4570
This commit is contained in:
Kevin Sawicki 2014-12-12 12:26:09 -08:00
parent d4c7fe4b47
commit 91770f2885
2 changed files with 6 additions and 0 deletions

View File

@ -259,6 +259,10 @@ describe "GitRepository", ->
editor.getBuffer().emitter.emit 'did-change-path'
expect(statusHandler.callCount).toBe 1
it "stops listening to the buffer when the repository is destroyed (regression)", ->
atom.project.getRepositories()[0].destroy()
expect(-> editor.save()).not.toThrow()
describe "when a project is deserialized", ->
[buffer, project2] = []

View File

@ -412,6 +412,8 @@ class GitRepository
bufferSubscriptions.add buffer.onDidDestroy =>
bufferSubscriptions.dispose()
@subscriptions.remove(bufferSubscriptions)
@subscriptions.add(bufferSubscriptions)
return
# Subscribes to editor view event.
checkoutHeadForEditor: (editor) ->