Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Catalog loaded bool #1216

merged 2 commits into from

3 participants


I found this commit lying about in my branches (yes, somebody's been tidying up!)

Not sure if it fixes a crash or something, but looks useful.
I also found a small optimisation commit somewhere, which didn't find its way into master, so it's here


The plug-ins use QSLibrarian, so I'm worried about adding an iVar. I suppose adding it to the end is probably safe (vs. inserting it into the middle somewhere). Is that true?


If you feel really concerned about 32bit compatibility, put it in a static BOOL var. QSLibrarian is supposed to be a singleton, right ? ;-)


Hehe. You can tell that when I originally did this change (a year ago) I was concerned about 32bit compatibility (see the original commit here )
Now you can see I'm not ;-)

I'm happy to use a static as per 83fab29f70117f70d226ce8b3b02d97b32ecf9ea if it makes everyone happy.


OK, I had forgotten it only affected subclasses. So this should be fine. I'll test it out.

@skurfer skurfer merged commit 85d602f into quicksilver:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 15, 2012
  1. @pjrobertson
  2. @pjrobertson

    use a BOOL to decide when the catalog is loaded.

    pjrobertson committed
    Ensures that plugins do not try and write the catalog until it has been loaded
This page is out of date. Refresh to see the latest.
3  Quicksilver/Code-QuickStepCore/QSExecutor.m
@@ -282,6 +282,9 @@ - (NSArray *)rankedActionsForDirectObject:(QSObject *)dObject indirectObject:(QS
- (NSArray *)rankedActionsForDirectObject:(QSObject *)dObject indirectObject:(QSObject *)iObject shouldBypass:(BOOL)bypass {
+ if (!dObject) {
+ return nil;
+ }
NSArray *actions = nil;
if ([[dObject handler] respondsToSelector:@selector(actionsForDirectObject:indirectObject:)])
actions = (NSMutableArray *)[[dObject handler] actionsForDirectObject:dObject indirectObject:iObject];
3  Quicksilver/Code-QuickStepCore/QSLibrarian.h
@@ -41,6 +41,9 @@ extern QSLibrarian *QSLib; // Shared Instance
NSMutableArray *invalidIndexes;
NSInteger scannerCount;
+ @private
+ BOOL catalogLoaded;
+ (id)sharedInstance;
8 Quicksilver/Code-QuickStepCore/QSLibrarian.m
@@ -50,6 +50,9 @@ - (void)loadDefaultCatalog {
- (id)init {
if (self = [super init]) {
+ // Set a BOOL to ensure nothing attempts to access the catalog until it's fully loaded
+ catalogLoaded = NO;
NSNumber *minScore = [[NSUserDefaults standardUserDefaults] objectForKey:@"QSMinimumScore"];
if (minScore) {
QSMinScore = [minScore doubleValue];
@@ -197,6 +200,7 @@ - (void)loadCatalogInfo {
[[customEntry children] addObject:[QSCatalogEntry entryWithDictionary:entry]];
+ catalogLoaded = YES;
[self reloadIDDictionary:nil];
//NSLog(@"load Catalog %p %@", catalog, [catalog getChildren]);
@@ -754,8 +758,8 @@ - (void)setScanTask:(QSTask *)value {
@implementation QSLibrarian (QSPlugInInfo)
- (BOOL)handleInfo:(id)info ofType:(NSString *)type fromBundle:(NSBundle *)bundle {
- [self registerPresets:info inBundle: bundle scan:[(QSApp *)NSApp completedLaunch]];
- if ([NSApp completedLaunch]) {
+ [self registerPresets:info inBundle: bundle scan:catalogLoaded];
+ if (catalogLoaded) {
[self reloadIDDictionary:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:QSCatalogStructureChanged object:nil];
Something went wrong with that request. Please try again.