quicksilver/Quicksilver — pull request #1648 by skurfer (2013-10-14 15:24:52+00:00)
Title: fix the object dictionary

Here’s what I was suggesting for #1625. The commits should be pretty clear. I could be completely wrong, but I thought I’d get this out there for discussion. It surely conflicts with some other open pulls.

So what will be different? In practice, I haven’t seen any difference, but there’s a significant *theoretical* difference: Temporary items (not in the catalog, but created in real-time by browsing or running an action) are no longer added to the object dictionary. It follows that…

1. We no longer need to “clean up” the object dictionary.
2. Triggers and other commands that used to break after a relaunch will be broken immediately upon creation instead. (That’s an improvement, in my book. More consistent. Less confusing and surprising.) But I haven’t tested that this actually happens.

One of my concerns was that if you browse into a huge folder, dismiss the interface, then call it back up to look at something else in the same list of results, something would break. But it looks like the correct thing is happening. That is, the result array holds onto the objects, so they are still available when you call the interface back up. If you do another search which updates the result array, all those old objects get deallocated immediately. (This is based on informal testing where I just watched the memory usage.)

The only thing I don’t like is that `QSObject` has some dependencies on `QSLibrarian`. I think we could work around it by posting notifications for most things, but I couldn’t see a way around it in `[QSObject parent]`.

Long term, all of the plug-ins would need to be updated to call `-[QSLib objectWithIdentifier:]`. Once that’s done, I have a crazy dream where `-[QSObject objectWithIdentifier:]` will do what `makeObjectWithIdentifier` does now (because I never get that right the first time).

Be sure to check out that first (mostly unrelated) commit. A class importing categories on itself had a bit of a smell to it, so I tried removing those. Then I just kept going.