fix: null _gatewayClient after dispose in OnSettingsSaved
When OnSettingsSaved switches to node mode, _gatewayClient was disposed but not set to null. This caused guards like if (_gatewayClient == null) return; in ShowQuickSend, RunHealthCheckAsync, and ToggleChannel to pass instead of short-circuiting, potentially calling into a disposed object (ObjectDisposedException) or producing unexpected behaviour. The _nodeService field already followed the correct pattern (null first, then dispose). Apply the same pattern to _gatewayClient. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
536d436989
commit
4a7206c8dc
@ -1606,6 +1606,7 @@ public partial class App : Application
|
||||
// Reconnect with new settings — mirror the startup if/else pattern
|
||||
// to avoid dual connections that cause gateway conflicts.
|
||||
_gatewayClient?.Dispose();
|
||||
_gatewayClient = null;
|
||||
var oldNodeService = _nodeService;
|
||||
_nodeService = null;
|
||||
try { oldNodeService?.Dispose(); } catch (Exception ex) { Logger.Warn($"Node dispose error: {ex.Message}"); }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user