Async readState and added tokens for lifetime management of async operations. This should prevent crashes when the service is destroyed while async operations are still pending.

This commit is contained in:
Mathew-D
2026-05-09 22:57:28 -04:00
parent 3a523696be
commit 42eb2f12da
2 changed files with 569 additions and 265 deletions
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -114,7 +114,7 @@ private:
void rebindActiveDevice(const std::string& devicePath);
void rebindActiveAccessPoint(const std::string& apPath);
void ensureWifiDeviceSubscribed(const std::string& devicePath);
[[nodiscard]] NetworkState readState();
void readStateAsync(std::function<void(NetworkState)> onComplete);
[[nodiscard]] NetworkChangeOrigin consumeWirelessEnabledChangeOrigin(bool enabled);
void emitChangedIfNeeded(NetworkState next);
@@ -131,6 +131,7 @@ private:
std::vector<AccessPointInfo> m_accessPoints;
std::vector<VpnConnectionInfo> m_vpnConnections;
std::vector<std::string> m_savedSsids;
std::shared_ptr<int> m_lifetimeToken;
bool m_refreshInFlight = false;
bool m_refreshQueued = false;
bool m_scanning = false;