From c151accb5d508b58095c9b989188bd2ffe9bb2bb Mon Sep 17 00:00:00 2001 From: Milly Date: Wed, 17 Apr 2024 07:28:40 +0900 Subject: [PATCH] :bug: Fix "once" callback leak Remove directly without calling the unregister method due to overhead. Delete unnecessary `silent`. --- autoload/denops/callback.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/autoload/denops/callback.vim b/autoload/denops/callback.vim index 94542ab8..72260cb1 100644 --- a/autoload/denops/callback.vim +++ b/autoload/denops/callback.vim @@ -17,7 +17,7 @@ function! denops#callback#unregister(id) abort if !has_key(s:registry, a:id) return endif - silent unlet s:registry[a:id] + unlet s:registry[a:id] endfunction function! denops#callback#call(id, ...) abort @@ -25,11 +25,10 @@ function! denops#callback#call(id, ...) abort throw printf('No callback function for %s exist', a:id) endif let l:entry = s:registry[a:id] - let l:ret = call(l:entry.callback, a:000) if l:entry.options.once - call denops#callback#unregister(a:id) + unlet s:registry[a:id] endif - return l:ret + return call(l:entry.callback, a:000) endfunction function! denops#callback#clear() abort