Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash calling a deallocated delegate, plus memory leak #19

Open
gobbledegook opened this issue Nov 7, 2023 · 0 comments
Open

crash calling a deallocated delegate, plus memory leak #19

gobbledegook opened this issue Nov 7, 2023 · 0 comments

Comments

@gobbledegook
Copy link

As you are probably aware, once the watcher thread has been started, there is no way to dealloc the VDKQueue object. This is because detachThread retains the target (which is "self"), so the retainCount is 2. Unless you provide a way to stop the thread, the object can never be released! Even worse, if the object was created by its delegate, and the delegate goes away, it will try to send messages to the delegate, causing a crash.

The fix I'm using is to add a new method (stopWatching:) which sets _keepWatcherThreadRunning to NO and removes all the watched path entries, then require the client to call it before calling release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant