inseven / fileaway

Document management app for iOS and macOS
https://fileaway.jbmorley.co.uk
MIT License
12 stars 3 forks source link

`DirectoryMonitor` instances leak if not explicitly stopped #518

Open jbmorley opened 1 year ago

jbmorley commented 1 year ago

The DirectoryMonitor update block retains self, meaning that there's a retain cycle. We need to break this retain cycle to ensure that directory monitors automatically stop and are cleaned up when they go out of scope. Unfortunately, it seems that EonilFSEventStream doesn't retain it's self reference before calling its completion block, meaning that the newly released self can disappear before calling the callback block, leading to a crash.

jbmorley commented 1 year ago

As part of this fix, we should explore whether we need a dedicated deinit in DirectoryMonitor to ensure everything is cancelled.