summaryrefslogtreecommitdiff
path: root/services/Network.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-23 13:50:38 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-23 13:50:38 +0800
commitd3462ee56bf689b40738cdf5e9a3b378e9996d4e (patch)
tree0eb6b5838193383e787d6d0a889c4460d89d1827 /services/Network.qml
parentdashboard: fix bongo cat playing when no media (diff)
downloadcaelestia-shell-d3462ee56bf689b40738cdf5e9a3b378e9996d4e.tar.gz
caelestia-shell-d3462ee56bf689b40738cdf5e9a3b378e9996d4e.tar.bz2
caelestia-shell-d3462ee56bf689b40738cdf5e9a3b378e9996d4e.zip
internal: fix memory leaks
Diffstat (limited to 'services/Network.qml')
-rw-r--r--services/Network.qml9
1 files changed, 3 insertions, 6 deletions
diff --git a/services/Network.qml b/services/Network.qml
index 3aa1dd6..49d61f8 100644
--- a/services/Network.qml
+++ b/services/Network.qml
@@ -29,12 +29,9 @@ Singleton {
const networks = JSON.parse(data).map(n => [n[0] === "yes", parseInt(n[1]), parseInt(n[2]), n[3]]);
const rNetworks = root.networks;
- const len = rNetworks.length;
- for (let i = 0; i < len; i++) {
- const network = rNetworks[i];
- if (!networks.find(n => n[2] === network?.frequency && n[3] === network?.ssid))
- rNetworks.splice(i, 1);
- }
+ const destroyed = rNetworks.filter(rn => !networks.find(n => n[2] === rn.frequency && n[3] === rn.ssid));
+ for (const network of destroyed)
+ rNetworks.splice(rNetworks.indexOf(network), 1).forEach(n => n.destroy());
for (const network of networks) {
const match = rNetworks.find(n => n.frequency === network[2] && n.ssid === network[3]);