From abcf099f87af0877c5be2bcfad229b2a83e4bf5c Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 29 Mar 2025 19:20:33 +1100 Subject: system: fix directory monitor Keep ref to monitor so it doesn't get garbage collected --- src/utils/system.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/utils/system.ts') 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; }; -- cgit v1.2.3-freya