Fixed a memory leak which would occur on every application switch.
parent
98f0757089
commit
64c401b5d8
|
@ -271,12 +271,18 @@ NSString *kIgnoreMediaKeysDefaultsKey = @"SPIgnoreMediaKeys";
|
||||||
-(void)appIsNowFrontmost:(ProcessSerialNumber)psn;
|
-(void)appIsNowFrontmost:(ProcessSerialNumber)psn;
|
||||||
{
|
{
|
||||||
NSValue *psnv = [NSValue valueWithBytes:&psn objCType:@encode(ProcessSerialNumber)];
|
NSValue *psnv = [NSValue valueWithBytes:&psn objCType:@encode(ProcessSerialNumber)];
|
||||||
|
|
||||||
NSDictionary *processInfo = (__bridge id)ProcessInformationCopyDictionary(
|
CFDictionaryRef cfDict = ProcessInformationCopyDictionary(
|
||||||
&psn,
|
&psn,
|
||||||
kProcessDictionaryIncludeAllInformationMask
|
kProcessDictionaryIncludeAllInformationMask
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!cfDict) return;
|
||||||
|
|
||||||
|
NSDictionary *processInfo = (__bridge id)cfDict;
|
||||||
NSString *bundleIdentifier = [processInfo objectForKey:(id)kCFBundleIdentifierKey];
|
NSString *bundleIdentifier = [processInfo objectForKey:(id)kCFBundleIdentifierKey];
|
||||||
|
|
||||||
|
CFRelease(cfDict);
|
||||||
|
|
||||||
NSArray *whitelistIdentifiers = [[NSUserDefaults standardUserDefaults] arrayForKey:kMediaKeyUsingBundleIdentifiersDefaultsKey];
|
NSArray *whitelistIdentifiers = [[NSUserDefaults standardUserDefaults] arrayForKey:kMediaKeyUsingBundleIdentifiersDefaultsKey];
|
||||||
if(![whitelistIdentifiers containsObject:bundleIdentifier]) return;
|
if(![whitelistIdentifiers containsObject:bundleIdentifier]) return;
|
||||||
|
|
Loading…
Reference in New Issue