Playlist entries are now processed on main thread.

CQTexperiment
matthewleon 2008-03-02 10:51:37 +00:00
parent d84a12d596
commit 92be178bf2
1 changed files with 21 additions and 23 deletions

View File

@ -309,20 +309,12 @@
return entryInfo;
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
- (void)processEntryInfo:(NSInvocationOperation *)operation
{
// We finished reading the info for a playlist entry
if ([keyPath isEqualToString:@"isFinished"] && [object isFinished])
{
// get the results
NSDictionary *entryInfo = [object result];
// get the playlist entry that the thread was inspecting
NSDictionary *entryInfo = [operation result];
PlaylistEntry *pe;
[[object invocation]getArgument:&pe atIndex:2];
// get the playlist entry that the thread was inspecting
[[operation invocation]getArgument:&pe atIndex:2];
if (entryInfo == nil)
{
pe.error = YES;
@ -333,14 +325,20 @@
[pe setValuesForKeysWithDictionary:entryInfo];
[playlistController updateTotalTime];
}
return;
}
//Hack so the display gets updated
PlaylistEntry *tempEntry = [playlistController currentEntry];
[playlistController setCurrentEntry:pe];
[playlistController setCurrentEntry:tempEntry];
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
// We finished reading the info for a playlist entry
if ([keyPath isEqualToString:@"isFinished"] && [object isFinished])
{
// stop observing
[object removeObserver:self forKeyPath:keyPath];
[self performSelectorOnMainThread:@selector(processEntryInfo:) withObject:object waitUntilDone:NO];
}
else
{