From f7678884f0f6b559df8b993192834ef7953c4880 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 23 Jan 2017 13:37:48 +0100 Subject: [PATCH] Race condition: make sure we're still in same buffer Fixes #207. --- autoload/sy/repo.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim index ac1a4bf..825f03e 100644 --- a/autoload/sy/repo.vim +++ b/autoload/sy/repo.vim @@ -40,6 +40,9 @@ endfunction function! s:callback_exit(job_id, exitval, ...) dict abort call sy#verbose('callback_exit()', self.vcs) call win_gotoid(self.winid) + if self.bufnr != bufnr('%') + return + endif call sy#repo#get_diff_{self.vcs}(a:exitval, self.stdoutbuf, self.do_register) silent! unlet b:job_id_{self.vcs} endfunction @@ -231,6 +234,7 @@ function! s:initialize_job(vcs, do_register) abort \ 'stdoutbuf': [], \ 'vcs': a:vcs, \ 'do_register': a:do_register, + \ 'bufnr': bufnr('%'), \ 'winid': win_getid(), \ } return [cmd, options]