Cut 9 Soul fixes: UTF-8 RTDP pong truncation, ServerBrowser row disposal guard, DirectoryReporter snapshot lock, and test deadline

This commit is contained in:
Meta Vens 2026-12-05 18:09:30 +01:00
commit fe1eec54a8
4 changed files with 84 additions and 36 deletions

View file

@ -31,6 +31,7 @@ public sealed partial class ServerBrowser : CanvasLayer
public int? PingMs;
public bool TimedOut;
public bool Probing = true;
public bool Disposed;
public Button? RowButton;
public Label? NameLabel;
@ -258,7 +259,7 @@ public sealed partial class ServerBrowser : CanvasLayer
var result = await ServerPingProbe.ProbeAsync(row.Host, row.Port, TimeSpan.FromMilliseconds(1400), ct).ConfigureAwait(false);
_mainThreadQueue.Enqueue(() =>
{
if (!IsInsideTree() || seq != _refreshSeq) return;
if (!IsInsideTree() || seq != _refreshSeq || row.Disposed || !_rows.Contains(row) || row.RowButton is null || !IsInstanceValid(row.RowButton)) return;
row.Probing = false;
if (result.Success && result.Summary is { } summary)
{
@ -299,7 +300,7 @@ public sealed partial class ServerBrowser : CanvasLayer
{
_mainThreadQueue.Enqueue(() =>
{
if (!IsInsideTree() || seq != _refreshSeq) return;
if (!IsInsideTree() || seq != _refreshSeq || row.Disposed || !_rows.Contains(row) || row.RowButton is null || !IsInstanceValid(row.RowButton)) return;
row.Probing = false;
row.PingMs = null;
row.TimedOut = true;
@ -502,6 +503,10 @@ public sealed partial class ServerBrowser : CanvasLayer
private void ClearRows()
{
for (int i = 0; i < _rows.Count; i++)
{
_rows[i].Disposed = true;
}
_rows.Clear();
if (_rowsContainer is null) return;
for (int i = _rowsContainer.GetChildCount() - 1; i >= 0; i--)
@ -517,7 +522,9 @@ public sealed partial class ServerBrowser : CanvasLayer
for (int i = _rows.Count - 1; i >= 0; i--)
{
if (!_rows[i].IsLocalProbe) continue;
var btn = _rows[i].RowButton;
var row = _rows[i];
row.Disposed = true;
var btn = row.RowButton;
_rows.RemoveAt(i);
if (btn is not null && IsInstanceValid(btn))
{
@ -615,7 +622,7 @@ public sealed partial class ServerBrowser : CanvasLayer
private void SyncRowVisual(ServerRowModel row)
{
if (row.RowButton is null) return;
if (row.Disposed || !_rows.Contains(row) || row.RowButton is null || !IsInstanceValid(row.RowButton)) return;
bool selected = string.Equals(_selectedKey, row.Key, StringComparison.Ordinal);
Color accent = selected