Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More crashes #986

Closed
wants to merge 8 commits into from
44 changes: 22 additions & 22 deletions Quicksilver/Code-QuickStepCore/QSCatalogEntry.m
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,8 @@ - (void)saveIndex {

// Lock the 'contents' mutablearray so that it cannot be changed whilst it's being written to file
@synchronized(contents) {
NSArray *writeArray = [[[self contents] arrayByPerformingSelector:@selector(dictionaryRepresentation)] copy];
NSArray *writeArray = [contents arrayByPerformingSelector:@selector(dictionaryRepresentation)];
[writeArray writeToFile:[[path stringByAppendingPathComponent:key] stringByAppendingPathExtension:@"qsindex"] atomically:YES];
[writeArray release];
}
}

Expand Down Expand Up @@ -476,27 +475,18 @@ - (id)source {
}

- (NSArray *)scannedObjects {
if (isScanning) {
#ifdef DEBUG
if (VERBOSE) NSLog(@"%@ is already being scanned", [self name]);
#endif
return nil;
} else {
[self setIsScanning:YES];
NSArray *itemContents = nil;
@autoreleasepool {
@try {
QSObjectSource *source = [self source];
itemContents = [[source objectsForEntry:info] retain];
}
@catch (NSException *exception) {
NSLog(@"An error ocurred while scanning \"%@\": %@", [self name], exception);
[exception printStackTrace];
}
NSArray *itemContents = nil;
@autoreleasepool {
@try {
QSObjectSource *source = [self source];
itemContents = [[source objectsForEntry:info] retain];
}
[self setIsScanning:NO];
return [itemContents autorelease];
}
@catch (NSException *exception) {
NSLog(@"An error ocurred while scanning \"%@\": %@", [self name], exception);
[exception printStackTrace];
}
}
return [itemContents autorelease];
}

- (BOOL)canBeIndexed {
Expand All @@ -505,6 +495,14 @@ - (BOOL)canBeIndexed {
}

- (NSArray *)scanAndCache {
if (isScanning) {
#ifdef DEBUG
if (VERBOSE) NSLog(@"%@ is already being scanned", [self name]);
#endif
return nil;
} else {

[self setIsScanning:YES];
NSString *ID = [self identifier];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName:QSCatalogEntryIsIndexing object:self];
Expand All @@ -523,7 +521,9 @@ - (NSArray *)scanAndCache {
[self willChangeValueForKey:@"self"];
[self didChangeValueForKey:@"self"];
[nc postNotificationName:QSCatalogEntryIndexed object:self];
[self setIsScanning:NO];
return itemContents;
}
}

- (void)scanForcedInThread:(NSNumber *)force {
Expand Down
6 changes: 4 additions & 2 deletions Quicksilver/Code-QuickStepCore/QSLibrarian.m
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,10 @@ - (void)reloadSets:(NSNotification *)notif {
@synchronized(catalog) {
for(QSCatalogEntry * entry in [catalog leafEntries]) {
//NSLog(@"entry %@", entry);
if ([entry contents] && [[entry contents] count]) {
[newDefaultSet addObjectsFromArray:[entry contents]];
@synchronized(entry) {
if ([entry contents] && [[entry contents] count]) {
[newDefaultSet addObjectsFromArray:[entry contents]];
}
}
}
}
Expand Down