Wrote dealloc for SpotlightPlaylistEntry. Still need to find large leak.

CQTexperiment
matthewleon 2008-03-08 23:47:29 +00:00
parent ed261fb51a
commit 2124066761
3 changed files with 525 additions and 536 deletions

File diff suppressed because it is too large Load Diff

View File

@ -43,11 +43,7 @@ static NSDictionary *importKeys;
+ (SpotlightPlaylistEntry *)playlistEntryWithMetadataItem:(NSMetadataItem *)metadataItem
{
SpotlightPlaylistEntry *entry = [[[SpotlightPlaylistEntry alloc] init] autorelease];
// Dictionary of the metadata values
NSDictionary *songAttributes =
[metadataItem valuesForAttributes:[importKeys allKeys]];
SpotlightPlaylistEntry *entry = [[[SpotlightPlaylistEntry alloc]init]autorelease];
// loop through the keys we want to extract
for (NSString *mdKey in importKeys) {
@ -55,7 +51,7 @@ static NSDictionary *importKeys;
// Just copy the object from metadata
if ([importTarget isKindOfClass:[NSString class]])
{
[entry setValue: [songAttributes objectForKey:mdKey]
[entry setValue: [metadataItem valueForAttribute:mdKey]
forKey: importTarget];
}
// Transform the value in metadata before copying it in
@ -65,7 +61,7 @@ static NSDictionary *importKeys;
NSValueTransformer *transformer =
[NSValueTransformer valueTransformerForName:[importTarget objectAtIndex:1]];
id transformedValue = [transformer transformedValue:
[songAttributes objectForKey:mdKey]];
[metadataItem valueForAttribute:mdKey]];
[entry setValue:transformedValue forKey: importKey];
}
// The importKeys dictionary contains something strange...
@ -85,6 +81,13 @@ static NSDictionary *importKeys;
return Nil;
}
- (void)dealloc
{
spotlightTrack = Nil;
length = Nil;
[super dealloc];
}
@synthesize length;
@synthesize spotlightTrack;

View File

@ -40,8 +40,6 @@ static NSPredicate * musicOnlyPredicate = nil;
NSValueTransformer *stringToSearchScopeTransformer = [[[StringToSearchScopeTransformer alloc]init]autorelease];
[NSValueTransformer setValueTransformer:stringToSearchScopeTransformer forName:@"StringToSearchScopeTransformer"];
[NSMetadataQuery exposeBinding:@"searchScopes"];
}
- (void)registerDefaults
@ -237,7 +235,7 @@ static NSPredicate * musicOnlyPredicate = nil;
else
{
NSString * wildcardString = [NSString stringWithFormat:@"*%@*", parsingString];
NSPredicate * pred =[NSPredicate predicateWithFormat:@"(kMDItemTitle LIKE[cd] %@) OR (kMDItemAlbum LIKE[cd] %@) OR (kMDItemAuthors LIKE[cd] %@)",
NSPredicate * pred = [NSPredicate predicateWithFormat:@"(kMDItemTitle LIKE[cd] %@) OR (kMDItemAlbum LIKE[cd] %@) OR (kMDItemAuthors LIKE[cd] %@)",
wildcardString, wildcardString, wildcardString];
[subpredicates addObject: pred];
}
@ -269,7 +267,6 @@ static NSPredicate * musicOnlyPredicate = nil;
{
self.query = nil;
self.searchString = nil;
[musicOnlyPredicate release];
[super dealloc];
}