-
Notifications
You must be signed in to change notification settings - Fork 286
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
Icon loading fixes #1142
Icon loading fixes #1142
Conversation
Man, I love the sound of Private APIs do when they disappear ;-).
[[self retain] autorelease]; | ||
loadThread = [NSThread currentThread]; | ||
// [NSThread setThreadPriority:0.0]; | ||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ | ||
NSArray *sourceArray = 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.
Could we just pass nil
as the parameter on line 57 and get rid of this variable? It's value never gets changed that I can see.
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.
Yeah, it's supposed to pass the array ivar. I will fix that.
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.
OK, cool. I wondered if it should pass the ivar (and actually tried it), but couldn't see any difference in the way the interface behaved.
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.
I think it won't change anything, since the delegate actually ignore it. But I will fix that anyway in the name of consistency ;-).
OK, so I thought this was to replace the |
I've checked that, and it looks like you're right, they are separate "queues". QSIconLoader is only responsible for loading the icons in the result controller (and the children view, which was buggy, and that this pulls fixes). Now about the NSOperationQueue, maybe we should drop that and use one of the global dispatch queues. I tried removing it altogether (from QSURLObjectHandler and QSFileSystemObjectHandler) and moving that to dispatch_async, but maybe it could be done one level above, by wrapping the call of And the lag seems to be caused by |
Right you are. And even better… it gets called 3 times! It shouldn't be called at all when selecting an object (unless you enable that "Show children in results list" preference). Wait, now that I look back over this… Is that what this pull request is all about? The behavior with that preference enabled? :-) If so, great, but I think most people turn it off just to avoid the lag we're talking about. |
Yeah, that's look like the culprit. This now tries to load children icons even when the children result view is disabled. I'll fix that, but this means user of the children result view will still see the lag, unless we find a way to remove the call to |
This use the High priority queue instead.
Looks good. I'll test it out for a while. One problem I ran into when trying to test this with some other branches: There’s a conflict with your other GCD branch. For some reason, when you try to merge them both, it wants to remove references to both |
Huh ? I've tried it, and while the merge is strange (since it deletes the |
Yes. Let me try starting from |
Hmmm, OK. Made a new branch from Hold on, got a crash in the background while typing this, but I'll see if it keeps happening before I waste your time with it. |
Apart from the very small use of As mentioned by Rob, I also get get a few icons that don't necessarily load unless you click the object (mainly .avi), but I can reproduce in ß70 so not a problem here. If there's no reply from @tiennou on the |
I can reproduce this every time by going into
Sounds good. I've been testing this for a long time without issue. |
Found a fix for the icons in the results list. I'll put it in another pull request after this is merged. |
This fixes icon loading in the children result view, drops a private API, and switch the icon loader to a gcd queue.
You can try adjust the queue priority (I started at high, but finally settled on low as you can't really tell the difference anyway. Also we don't want to make people without SSDs unhappy, right ? ;-))