Fix opening `LogView` when reloading customizations

As `reload_customizations` was called during save operations, opening 
the `LogView` changed `core.active_view` which caused some errors to be 
thrown.
This commit is contained in:
Guldoman 2022-06-28 04:21:43 +02:00
parent 438ed6984a
commit 259de54c33
No known key found for this signature in database
GPG Key ID: EA928C8BDA1A8825
1 changed files with 12 additions and 8 deletions

View File

@ -68,6 +68,9 @@ local function reload_customizations()
local user_error = not core.load_user_directory() local user_error = not core.load_user_directory()
local project_error = not core.load_project_module() local project_error = not core.load_project_module()
if user_error or project_error then if user_error or project_error then
-- Use core.add_thread to delay opening the LogView, as opening
-- it directly here disturbs the normal save operations.
core.add_thread(function()
local LogView = require "core.logview" local LogView = require "core.logview"
local rn = core.root_view.root_node local rn = core.root_view.root_node
for _,v in pairs(core.root_view.root_node:get_children()) do for _,v in pairs(core.root_view.root_node:get_children()) do
@ -77,6 +80,7 @@ local function reload_customizations()
end end
end end
command.perform("core:open-log") command.perform("core:open-log")
end)
end end
end end