Improve initial state transfer locking
This commit is contained in:
parent
6ec5bbe5a3
commit
d63d7e7ffc
22
Ooui/UI.cs
22
Ooui/UI.cs
|
@ -573,34 +573,40 @@ namespace Ooui
|
|||
void QueueStateMessagesLocked (EventTarget target)
|
||||
{
|
||||
if (target == null) return;
|
||||
var created = false;
|
||||
foreach (var m in target.StateMessages) {
|
||||
if (m.MessageType == MessageType.Create) {
|
||||
createdIds.Add (m.TargetId);
|
||||
created = true;
|
||||
}
|
||||
if (created) {
|
||||
QueueMessageLocked (m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QueueMessageLocked (Message message)
|
||||
{
|
||||
//
|
||||
// Make sure all the referenced objects have been created
|
||||
//
|
||||
if (message.MessageType == MessageType.Create) {
|
||||
createdIds.Add (message.TargetId);
|
||||
}
|
||||
else {
|
||||
if (!createdIds.Contains (message.TargetId)) {
|
||||
createdIds.Add (message.TargetId);
|
||||
QueueStateMessagesLocked (element.GetElementById (message.TargetId));
|
||||
}
|
||||
if (message.Value is Array a) {
|
||||
if (message.Value is EventTarget ve) {
|
||||
if (!createdIds.Contains (ve.Id)) {
|
||||
QueueStateMessagesLocked (ve);
|
||||
}
|
||||
}
|
||||
else if (message.Value is Array a) {
|
||||
for (var i = 0; i < a.Length; i++) {
|
||||
// Console.WriteLine ($"A{i} = {a.GetValue(i)}");
|
||||
if (a.GetValue (i) is EventTarget e && !createdIds.Contains (e.Id)) {
|
||||
createdIds.Add (e.Id);
|
||||
QueueStateMessagesLocked (e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add it to the queue
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue