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
Scanning/Threading fixes #1319
Scanning/Threading fixes #1319
Conversation
No other changes made
Ensure that KVO notifications are received on the main thread and UIKit can handle changes correctly
Reverts commit 5985b7f. This is a multi-thread issue, so checking a BOOL at one moment in time won't fix the problem
P.S. the QSTask things are here just because I was playing with |
Yeah, I thought about it and you were right. The only way to be sure is to put them on the same thread. With that in mind, I'm wondering if we should also change Otherwise, it looks OK at first glance. I'll look it over again in the morning. What's with all the deletions in the NIBs? Just Xcode being Xcode? :-) |
Not really, since if what you say happens, and the block is reached (say on What you say might happen, and the isScanning check wouldn't be useful in
Yep. Opened, clicked 'Fix inconsistencies'. Closed
|
Ah, that's why you get paid the big bucks. :-)
Way to anticipate my next question: "Why even have it?" Probably worth keeping it in. |
Dammit, I'm slow... should have figured that out! :-) I answered it really in my last reply
|
Yeah, that's what I was trying to say. You already answered it. |
NSString *indexPath = [[[pIndexLocation stringByStandardizingPath] stringByAppendingPathComponent:[self identifier]]stringByAppendingPathExtension:@"qsindex"]; | ||
if (![manager fileExistsAtPath:indexPath isDirectory:nil]) { | ||
isValid = NO; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just isValid = [manager fileExistsAtPath:indexPath isDirectory:nil]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno, I think it's probably a bit clearer (for reading), but no reason really. If you look at the old code you can see I just changed return NO
to isValid = NO
since blocks of course can't 'return'
Nooooooooo! Looks like this still isn't fixed, 4 crash logs this morning. :( I think perhaps the problem was with the I've also added This is a fun exercise right? :D |
Here's another attempt at fixing the problem.
I have reverted @skurfer's fix, and gone back to my original fix. This time, however, I am checking to make sure we're not already on the
scanQueue
before dispatching a block to it. If we are, then we just dispatch the block (as we're on thescanQueue
)The changes made to QSTask.m are to ensure that KVO iVars are changed on the main thread, which of course must be done for UI things
The new QSGCD class takes care of checking Queues/threads etc. The basis of it is something I've previously discussed with @skurfer (and is discussed here). If/when this is merged, I'll revert 98a7a03 and use the new
runOnMainQueueSync
thread I've created