quicksilver/Quicksilver — pull request #1321 by pjrobertson (2013-01-15 09:08:49+00:00)
Title: Further attempts at squashing the catalog scanning crash

I think this has now just become a competition between me and skurfer to see who can create the most commits that are redundant ;-)

I think I'm winning atm :D

-------

From #1319:

Nooooooooo!

Looks like this still isn't fixed, 4 crash logs this morning. :(
How is this possible!?

I think perhaps the problem was with the `dispatch_async` call in `saveIndex`. I've changed it around slightly now so it only uses `dispatch_sync`, and if it's being called on the `scanQueue` queue, then it won't bother trying to add it to the `scanQueue` again. (If I'm correct, `dispatch_async` will make a 'copy' of the code/iVars etc. when it's called and add them to memory for when the block can be run, whereas `dispatch_sync` will wait until the block can be run *then* make a copy of the code/iVars, so potentially the iVars in the two blocks could be different.

I've also added `__block` to the `indexDate` iVar. I remember @skurfer mentioned something about not having to do this if you're using setters, but I couldn't remember the reason why, and I think it's better to be safe

This is a fun exercise right? :D