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 COORDINATOR_VERSION = "v0.21.1"
|
||||
local COORDINATOR_VERSION = "v0.21.2"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
@ -52,6 +52,8 @@ function pgi.delete_pkt_entry(session_id)
|
||||
if not success then
|
||||
log.error(util.c("PGI: failed to delete PKT entry (", result, ")"), true)
|
||||
end
|
||||
else
|
||||
log.debug(util.c("PGI: tried to delete unknown PKT entry ", session_id))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@ local flasher = require("graphics.flasher")
|
||||
|
||||
local core = {}
|
||||
|
||||
core.version = "1.0.1"
|
||||
core.version = "1.0.2"
|
||||
|
||||
core.flasher = flasher
|
||||
core.events = events
|
||||
|
@ -71,7 +71,8 @@ function element.new(args, child_offset_x, child_offset_y)
|
||||
p_window = nil, ---@type table
|
||||
position = { x = 1, y = 1 }, ---@type coordinate_2d
|
||||
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 = {},
|
||||
mt = {}
|
||||
}
|
||||
@ -352,13 +353,14 @@ function element.new(args, child_offset_x, child_offset_y)
|
||||
|
||||
local child_element = child.get()
|
||||
|
||||
if key == nil then
|
||||
table.insert(protected.children, child_element)
|
||||
return #protected.children
|
||||
else
|
||||
protected.children[key] = child_element
|
||||
return key
|
||||
local id = key ---@type string|integer|nil
|
||||
if id == nil then
|
||||
id = self.next_id
|
||||
self.next_id = self.next_id + 1
|
||||
end
|
||||
|
||||
protected.children[id] = child_element
|
||||
return id
|
||||
end
|
||||
|
||||
-- remove a child element
|
||||
|
@ -60,6 +60,8 @@ function pgi.delete_rtu_entry(session_id)
|
||||
if not success then
|
||||
log.error(util.c("PGI: failed to delete RTU entry (", result, ")"), true)
|
||||
end
|
||||
else
|
||||
log.debug(util.c("PGI: tried to delete unknown RTU entry ", session_id))
|
||||
end
|
||||
end
|
||||
|
||||
@ -87,6 +89,8 @@ function pgi.delete_pdg_entry(session_id)
|
||||
if not success then
|
||||
log.error(util.c("PGI: failed to delete PDG entry (", result, ")"), true)
|
||||
end
|
||||
else
|
||||
log.debug(util.c("PGI: tried to delete unknown PDG entry ", session_id))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor")
|
||||
|
||||
local svsessions = require("supervisor.session.svsessions")
|
||||
|
||||
local SUPERVISOR_VERSION = "v0.20.3"
|
||||
local SUPERVISOR_VERSION = "v0.20.4"
|
||||
|
||||
local println = util.println
|
||||
local println_ts = util.println_ts
|
||||
|
Loading…
Reference in New Issue
Block a user