v5.2: stability and polish — deep-audit bug fixes + install-flow fixes

Verified findings from a multi-dimension code audit, plus the two install-flow bugs:
- Fix Opus encoder use-after-free on a codec/rate change while streaming (guard swap vs encode).
- Fix "both" single-file recording dropping audio + drifting (drain both directions in lockstep).
- Fix broken clip counter, UPnP teardown on exit, auto-update-restart foreground grant, and a
  malformed-Opus-format packet orphaning a playout session forever.
- Post-install relaunch now respects start-minimised; uninstall is path-aware so it won't clear a
  different copy's run-at-startup.
- Perf/hygiene: cache AppConfig off UI hot paths, fold per-peer EQ+gain into one pass, deterministic
  disposal (tray menu, timers, COM shortcut, Process handles, process meter), ring-buffer overflow
  guard, receiver session-lock fix, remote-control allow-list moved onto the UI thread.
- Remove dead code (two IsAsioBackend, SessionPlayout.Reset, IsSameEndpoint, RemSoundUpdater
  IDisposable); several stale-doc fixes.

Deferred (not in this release): drift-estimator tweak, peer-discovery pruning, uninstall retry-loop,
encryption nonce. Wire format unchanged (interops v3.3-v5.1). Version -> 5.2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-09 20:54:53 +01:00
co-authored by Claude Opus 4.8
parent 7038fef67c
commit 2fb9274a95
28 changed files with 408 additions and 198 deletions
+29
View File
@@ -97,4 +97,33 @@ internal static class StartupAutoStart
return false;
}
}
/// <summary>Remove the Run-key entry ONLY if it currently points at an exe inside
/// <paramref name="folder"/>. Used by the uninstaller so removing an INSTALLED copy never wipes a
/// DIFFERENT copy's autostart entry (e.g. a portable copy the user still wants launching at login)
/// that happens to share the single "RemSound" value name. Returns true if the entry is gone
/// afterwards or was left alone because it points elsewhere; false only on registry error.</summary>
public static bool TryDisableIfPointsInto(string folder)
{
try
{
if (string.IsNullOrWhiteSpace(folder)) return false;
using var key = Registry.CurrentUser.OpenSubKey(RunKeyPath, writable: true);
if (key is null) return true; // No Run subkey → nothing to disable.
var value = (key.GetValue(ValueName) as string)?.Trim().Trim('"');
if (string.IsNullOrWhiteSpace(value)) return true; // nothing set for us.
var target = System.IO.Path.GetFullPath(folder)
.TrimEnd(System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar);
// Only our own installed copy's entry (its exe lives inside the folder being removed).
if (value.StartsWith(target, StringComparison.OrdinalIgnoreCase))
{
key.DeleteValue(ValueName, throwOnMissingValue: false);
}
return true;
}
catch
{
return false;
}
}
}