diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-06 21:57:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-06 21:57:49 -0400 |
| commit | d32d4a6e0f0c571941f1fd37759ca1ebbdd5f488 (patch) | |
| tree | 8cef3a32081bd0758d349a5d810d6f366def5f17 /lua/telescope/entry_manager.lua | |
| parent | caf370cc378e7c606fd4f59c46533b0b0decbcea (diff) | |
fix: Reduce memory leaks (#148)
It is not 100% clear that we've gotten ALL the memory leaks, but it
seems much much much better and doesn't look like it's going to die
immediately or as often anymore :)
Diffstat (limited to 'lua/telescope/entry_manager.lua')
| -rw-r--r-- | lua/telescope/entry_manager.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lua/telescope/entry_manager.lua b/lua/telescope/entry_manager.lua index bca4e55..532cca2 100644 --- a/lua/telescope/entry_manager.lua +++ b/lua/telescope/entry_manager.lua @@ -71,7 +71,7 @@ function EntryManager:should_save_result(index) return index <= self.max_results end -function EntryManager:add_entry(score, entry) +function EntryManager:add_entry(picker, score, entry) score = score or 0 if score >= self.worst_acceptable_score then @@ -82,7 +82,7 @@ function EntryManager:add_entry(score, entry) self.info.looped = self.info.looped + 1 if item.score > score then - return self:insert(index, { + return self:insert(picker, index, { score = score, entry = entry, }) @@ -94,13 +94,13 @@ function EntryManager:add_entry(score, entry) end end - return self:insert({ + return self:insert(picker, { score = score, entry = entry, }) end -function EntryManager:insert(index, entry) +function EntryManager:insert(picker, index, entry) if entry == nil then entry = index index = #self.entry_state + 1 @@ -113,7 +113,7 @@ function EntryManager:insert(index, entry) self.info.inserted = self.info.inserted + 1 next_entry = self.entry_state[index] - self.set_entry(index, entry.entry) + self.set_entry(picker, index, entry.entry) self.entry_state[index] = entry last_score = entry.score |
