Skip to content

Commit e2e6b2b

Browse files
committed
resolve resource leak in purge_all_state
1 parent 5830585 commit e2e6b2b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lua/nvim-tree.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,16 @@ local function localise_default_opts()
786786
end
787787

788788
function M.purge_all_state()
789-
require("nvim-tree.watcher").purge_watchers()
790789
view.close_all_tabs()
791790
view.abandon_all_windows()
792-
if core.get_explorer() ~= nil then
791+
local explorer = core.get_explorer()
792+
if explorer then
793793
require("nvim-tree.git").purge_state()
794+
explorer:destroy()
794795
core.reset_explorer()
795796
end
797+
-- purge orphaned that were not destroyed by their nodes
798+
require("nvim-tree.watcher").purge_watchers()
796799
end
797800

798801
---@param conf table|nil

0 commit comments

Comments
 (0)