summaryrefslogtreecommitdiff
path: root/src/utils/system.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-29 19:20:33 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-29 19:20:33 +1100
commitabcf099f87af0877c5be2bcfad229b2a83e4bf5c (patch)
tree06bbd8350686e242d3b6848343f05ef61d71d3a5 /src/utils/system.ts
parentsidebar: allow seeking (diff)
downloadcaelestia-shell-abcf099f87af0877c5be2bcfad229b2a83e4bf5c.tar.gz
caelestia-shell-abcf099f87af0877c5be2bcfad229b2a83e4bf5c.tar.bz2
caelestia-shell-abcf099f87af0877c5be2bcfad229b2a83e4bf5c.zip
system: fix directory monitor
Keep ref to monitor so it doesn't get garbage collected
Diffstat (limited to 'src/utils/system.ts')
-rw-r--r--src/utils/system.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils/system.ts b/src/utils/system.ts
index 2e9fa4a..8ccb5d1 100644
--- a/src/utils/system.ts
+++ b/src/utils/system.ts
@@ -76,6 +76,7 @@ export const bindCurrentTime = (
return bind(time);
};
+const monitors = new Set();
export const monitorDirectory = (
path: string,
callback: (
@@ -102,5 +103,9 @@ export const monitorDirectory = (
}
}
+ // Keep ref to monitor so it doesn't get GCed
+ monitors.add(monitor);
+ monitor.connect("notify::cancelled", () => monitor.cancelled && monitors.delete(monitor));
+
return monitor;
};