From 1580d923d363850de68435e127f4bddcdc7207dd Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 4 Oct 2022 18:26:33 -0400 Subject: [PATCH] Fixing minor bug relating to TreeView's cache. (#1136) Reviewed by Guldo; should fix things, merging. --- data/plugins/treeview.lua | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua index 4b95e240..0a14e9b7 100644 --- a/data/plugins/treeview.lua +++ b/data/plugins/treeview.lua @@ -50,20 +50,6 @@ function TreeView:new() self.item_icon_width = 0 self.item_text_spacing = 0 - - self:add_core_hooks() -end - - -function TreeView:add_core_hooks() - -- When a file or directory is deleted we delete the corresponding cache entry - -- because if the entry is recreated we may use wrong information from cache. - local on_delete = core.on_dirmonitor_delete - core.on_dirmonitor_delete = function(dir, filepath) - local cache = self.cache[dir.name] - if cache then cache[filepath] = nil end - on_delete(dir, filepath) - end end @@ -86,7 +72,7 @@ function TreeView:get_cached(dir, item, dirname) -- used only to identify the entry into the cache. local cache_name = item.filename .. (item.topdir and ":" or "") local t = dir_cache[cache_name] - if not t then + if not t or t.type ~= item.type then t = {} local basename = common.basename(item.filename) if item.topdir then