Playlist loader: No longer do background metadata reading on Intel machines, where VGMStream mysteriously clobbers the stack at random when run in the background
This commit is contained in:
parent
60ad561a26
commit
ea589b2635
1 changed files with 46 additions and 8 deletions
|
@ -32,6 +32,22 @@
|
||||||
|
|
||||||
#import "Logging.h"
|
#import "Logging.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
|
||||||
|
@ -466,6 +482,10 @@ 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];
|
||||||
[arrayRest removeObjectAtIndex:0];
|
[arrayRest removeObjectAtIndex:0];
|
||||||
|
@ -474,6 +494,13 @@ NSMutableDictionary * dictionaryWithPropertiesOfObject(id obj, NSArray * filterL
|
||||||
if ([arrayRest count])
|
if ([arrayRest count])
|
||||||
[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) {
|
||||||
|
@ -680,9 +707,20 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
||||||
[playlistController setSelectionIndexes:[NSIndexSet indexSet]];
|
[playlistController setSelectionIndexes:[NSIndexSet indexSet]];
|
||||||
|
|
||||||
if ([entries count])
|
if ([entries count])
|
||||||
|
{
|
||||||
|
#if TARGET_CPU_X86
|
||||||
|
if (processIsTranslated())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
[self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries];
|
[self performSelectorInBackground:@selector(loadInfoForEntries:) withObject:entries];
|
||||||
}
|
}
|
||||||
|
#if TARGET_CPU_X86
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self performSelectorOnMainThread:@selector(syncLoadInfoForEntries:) withObject:entries waitUntilDone:YES];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue