Race condition: make sure we're still in same buffer

Fixes #207.
This commit is contained in:
Marco Hinz 2017-01-23 13:37:48 +01:00
parent e43155f3e1
commit f7678884f0
No known key found for this signature in database
GPG Key ID: 1C980A1B657B4A4F

View File

@ -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]