karelia/iMedia — pull request #53 by danielpunkass (2012-03-18 19:16:57+00:00)
Title: Fix for repeatedly oversubscribing to FSEvents on reload

Mike - I chickened out about trying to somehow remedy my repo to avoid the duplicate commits. I had ideas such as deleting the repo and starting over from a fresh fork, but I'm afraid what that might do to your ability to cleanly merge, etc. I think what's best if you can stomach it is to just accept this pull request with the "junk commits" included. I'll be more careful going forward to try to keep my master branch pristine.

Original comments:

Previously we were abusing FSEvents by re-registering for notification watched nodes on every reload. I noticed during testing with aggressive reloads that it was actually possible to fry the FSEvents system so that it stopped registering new events.

I added an assertion in addPath: in UKFSEventsWatcher, to ensure that in normal
usage no path is ever registered twice.

I added new helper methods in IMBLibraryController to centralize registration
and deregistration for FS events. Then I added a new call in -reload to
ensure that any existing event registrations for the nodes we are about to
reload get unregistered before reloading.