mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
#293 fixed race condition with graphics element IDs
This commit is contained in:
parent
681bb0963e
commit
def02a94d2
@ -22,7 +22,7 @@ local sounder = require("coordinator.sounder")
|
|||||||
|
|
||||||
local apisessions = require("coordinator.session.apisessions")
|
local apisessions = require("coordinator.session.apisessions")
|
||||||
|
|
||||||
local COORDINATOR_VERSION = "v0.21.1"
|
local COORDINATOR_VERSION = "v0.21.2"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
@ -52,6 +52,8 @@ function pgi.delete_pkt_entry(session_id)
|
|||||||
if not success then
|
if not success then
|
||||||
log.error(util.c("PGI: failed to delete PKT entry (", result, ")"), true)
|
log.error(util.c("PGI: failed to delete PKT entry (", result, ")"), true)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
log.debug(util.c("PGI: tried to delete unknown PKT entry ", session_id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ local flasher = require("graphics.flasher")
|
|||||||
|
|
||||||
local core = {}
|
local core = {}
|
||||||
|
|
||||||
core.version = "1.0.1"
|
core.version = "1.0.2"
|
||||||
|
|
||||||
core.flasher = flasher
|
core.flasher = flasher
|
||||||
core.events = events
|
core.events = events
|
||||||
|
@ -71,7 +71,8 @@ function element.new(args, child_offset_x, child_offset_y)
|
|||||||
p_window = nil, ---@type table
|
p_window = nil, ---@type table
|
||||||
position = { x = 1, y = 1 }, ---@type coordinate_2d
|
position = { x = 1, y = 1 }, ---@type coordinate_2d
|
||||||
bounds = { x1 = 1, y1 = 1, x2 = 1, y2 = 1 }, ---@class element_bounds
|
bounds = { x1 = 1, y1 = 1, x2 = 1, y2 = 1 }, ---@class element_bounds
|
||||||
next_y = 1,
|
next_y = 1, -- next child y coordinate
|
||||||
|
next_id = 0, -- next child ID
|
||||||
subscriptions = {},
|
subscriptions = {},
|
||||||
mt = {}
|
mt = {}
|
||||||
}
|
}
|
||||||
@ -352,13 +353,14 @@ function element.new(args, child_offset_x, child_offset_y)
|
|||||||
|
|
||||||
local child_element = child.get()
|
local child_element = child.get()
|
||||||
|
|
||||||
if key == nil then
|
local id = key ---@type string|integer|nil
|
||||||
table.insert(protected.children, child_element)
|
if id == nil then
|
||||||
return #protected.children
|
id = self.next_id
|
||||||
else
|
self.next_id = self.next_id + 1
|
||||||
protected.children[key] = child_element
|
|
||||||
return key
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected.children[id] = child_element
|
||||||
|
return id
|
||||||
end
|
end
|
||||||
|
|
||||||
-- remove a child element
|
-- remove a child element
|
||||||
|
@ -60,6 +60,8 @@ function pgi.delete_rtu_entry(session_id)
|
|||||||
if not success then
|
if not success then
|
||||||
log.error(util.c("PGI: failed to delete RTU entry (", result, ")"), true)
|
log.error(util.c("PGI: failed to delete RTU entry (", result, ")"), true)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
log.debug(util.c("PGI: tried to delete unknown RTU entry ", session_id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -87,6 +89,8 @@ function pgi.delete_pdg_entry(session_id)
|
|||||||
if not success then
|
if not success then
|
||||||
log.error(util.c("PGI: failed to delete PDG entry (", result, ")"), true)
|
log.error(util.c("PGI: failed to delete PDG entry (", result, ")"), true)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
log.debug(util.c("PGI: tried to delete unknown PDG entry ", session_id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
|
|||||||
|
|
||||||
local svsessions = require("supervisor.session.svsessions")
|
local svsessions = require("supervisor.session.svsessions")
|
||||||
|
|
||||||
local SUPERVISOR_VERSION = "v0.20.3"
|
local SUPERVISOR_VERSION = "v0.20.4"
|
||||||
|
|
||||||
local println = util.println
|
local println = util.println
|
||||||
local println_ts = util.println_ts
|
local println_ts = util.println_ts
|
||||||
|
Loading…
Reference in New Issue
Block a user