Revert ea589b2635, and fix reloading info for entries on Intel, by invoking the reloader in the background instead of directly calling it from the UI thread

This commit is contained in:
Christopher Snowhill 2022-01-07 02:12:49 -08:00
parent ea589b2635
commit 00052130a0
2 changed files with 2 additions and 36 deletions

View file

@ -1095,7 +1095,7 @@
pe.metadataLoaded = NO; pe.metadataLoaded = NO;
} }
[playlistLoader loadInfoForEntries:selectedobjects]; [playlistLoader performSelectorInBackground:@selector(loadInfoForEntries:) withObject:selectedobjects];
} }
} }

View file

@ -34,20 +34,6 @@
#import <TargetConditionals.h> #import <TargetConditionals.h>
#if TARGET_CPU_X86
static int processIsTranslated() {
int ret = 0;
size_t size = sizeof(ret);
if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == -1)
{
if (errno == ENOENT)
return 0;
return -1;
}
return ret;
}
#endif
@implementation PlaylistLoader @implementation PlaylistLoader
- (id)init - (id)init
@ -482,9 +468,6 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
//Clear the selection //Clear the selection
[playlistController setSelectionIndexes:[NSIndexSet indexSet]]; [playlistController setSelectionIndexes:[NSIndexSet indexSet]];
#if TARGET_CPU_X86
if (processIsTranslated())
#endif
{ {
NSArray* arrayFirst = [NSArray arrayWithObject:[entries objectAtIndex:0]]; NSArray* arrayFirst = [NSArray arrayWithObject:[entries objectAtIndex:0]];
NSMutableArray* arrayRest = [entries mutableCopy]; NSMutableArray* arrayRest = [entries mutableCopy];
@ -495,12 +478,6 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
[self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:arrayRest]; [self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:arrayRest];
return entries; return entries;
} }
#if TARGET_CPU_X86
else
{
[self performSelectorOnMainThread:@selector(syncLoadInfoForEntries:) withObject:entries waitUntilDone:YES];
}
#endif
} }
static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_block_t block) { static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_block_t block) {
@ -708,18 +685,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
if ([entries count]) if ([entries count])
{ {
#if TARGET_CPU_X86 [self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries];
if (processIsTranslated())
#endif
{
[self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries];
}
#if TARGET_CPU_X86
else
{
[self performSelectorOnMainThread:@selector(syncLoadInfoForEntries:) withObject:entries waitUntilDone:YES];
}
#endif
} }
return entries; return entries;