Skip to content

Commit c727a3f

Browse files
authored
Merge pull request #334 from vim-denops/remove-callback-before
🐛 Fix "once" callback leak
2 parents 2d11652 + c151acc commit c727a3f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

autoload/denops/callback.vim

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@ function! denops#callback#unregister(id) abort
1717
if !has_key(s:registry, a:id)
1818
return
1919
endif
20-
silent unlet s:registry[a:id]
20+
unlet s:registry[a:id]
2121
endfunction
2222

2323
function! denops#callback#call(id, ...) abort
2424
if !has_key(s:registry, a:id)
2525
throw printf('No callback function for %s exist', a:id)
2626
endif
2727
let l:entry = s:registry[a:id]
28-
let l:ret = call(l:entry.callback, a:000)
2928
if l:entry.options.once
30-
call denops#callback#unregister(a:id)
29+
unlet s:registry[a:id]
3130
endif
32-
return l:ret
31+
return call(l:entry.callback, a:000)
3332
endfunction
3433

3534
function! denops#callback#clear() abort

0 commit comments

Comments
 (0)