mirror of
https://github.com/britzl/monarch.git
synced 2025-06-27 02:17:53 +02:00
Fixed an error that appears when trying to delete an instance that is already deleted. (#109)
* Prevent deleting already removed instances. * Prehashed empty hash. * Use go.exists instead of pcall, when detecting non existing instances.
This commit is contained in:
parent
b78b896ada
commit
6ba3064749
@ -430,8 +430,10 @@ local function unload(screen, force)
|
||||
elseif screen.factory then
|
||||
log("unload() factory", screen.id)
|
||||
for id, instance in pairs(screen.factory_ids) do
|
||||
if go.exists(instance) then
|
||||
go.delete(instance)
|
||||
end
|
||||
end
|
||||
screen.factory_ids = nil
|
||||
if screen.auto_preload and not force then
|
||||
screen.loaded = false
|
||||
@ -1374,8 +1376,10 @@ function M.on_post(id, fn_or_url)
|
||||
end
|
||||
end
|
||||
|
||||
local empty_hash = hash("")
|
||||
|
||||
local function url_to_key(url)
|
||||
return (url.socket or hash("")) .. (url.path or hash("")) .. (url.fragment or hash(""))
|
||||
return (url.socket or empty_hash) .. (url.path or empty_hash) .. (url.fragment or empty_hash)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user