Skip to content

Loading…

Bug fixes #1114

Merged
merged 15 commits into from

3 participants

@tiennou
Quicksilver OS X member

Late time issue-fixing-frenzy ;-).

See individual commits for details.

@pjrobertson
Quicksilver OS X member

What's the point of this method? I haven't looked about in the code, but surely people should just be calling [trigger setEnabled:NO] directly, like you're doing within the method?!

Quicksilver OS X member

IIRC it's declared in the interface, but was unimplemented so that fixes it. I haven't checked all plugins, but maybe it can be dropped entirely...

@pjrobertson
Quicksilver OS X member

Nice. Today's quiz question: Any ideas why it may have been there in the first place?!

@pjrobertson
Quicksilver OS X member

I've noticed that Xcode 4.4. is now much better at giving warnings. Loads have appeared since the last warning fix frenzy during 64 bit changes :)

@pjrobertson
Quicksilver OS X member

This should probably go into the release branch (the changes to QSObject_FileHandling.m). Thoughts @skurfer?

As long as it's not over-releasing now ;-)

@pjrobertson

I'm sure there was a reason why I originally chose not to escape # characters, but I can't remember why. I'll have a think, but I'm pretty sure it will be something to do with search URLs and the web search plugin

@skurfer skurfer commented on the diff
Quicksilver/Code-QuickStepCore/QSObjectFormatter.m
@@ -12,7 +12,7 @@ - (BOOL)getObjectValue:(id *)obj forString:(NSString *)string errorDescription:(
return YES;
}
- (NSString *)stringForObjectValue:(id)anObject {
- return [anObject name];
+ return [(QSObject *)anObject name];
}
@skurfer Quicksilver OS X member
skurfer added a note

Why can't we just tell this method to expect a QSObject instead of id?

@tiennou Quicksilver OS X member
tiennou added a note

I was shoddy of changing the interface mainly ;-). But yeah, it doesn't really matter so I'll change the signature instead.

@tiennou Quicksilver OS X member
tiennou added a note

And now I become doubtful ;-). It's only use is in a commented section in QSObjectCell. I think it might have been an attempt to modernize display of object by creating a real formatter. What do you think ?

@skurfer Quicksilver OS X member
skurfer added a note

I thought you meant this method, but you're referring to the entire class. So should we just remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@skurfer
Quicksilver OS X member

I was doing something small this morning that probably isn't worth a separate pull request. Maybe it could be added to this one?

All I did was:

  • add [resource closeFile]; to line 56 of NSPasteboard_BLTRExtensions.m.
  • remove #import "NDResourceFork.h" from QSObject_FileHandling.m. It doesn't appear to be used there.

This was in an effort to silence the errors people have been complaining about on the mailing list.

NDAlias ERROR: you neglected to call closeFile: before disposing this NDResourceFork
@tiennou
Quicksilver OS X member

That's fun, I think it's been more or less since that was updated that I get various stashes fixing that one in diverse ways ;-). I thought about putting it directly in NDResourceFork, like in -dealloc. I will investigate and add a commit.

@skurfer
Quicksilver OS X member

Yeah, I have to wonder about that error. If you know closeFile: needs to be called, just call it and shut up. :-)

I didn't want to make changes to the “external” files, but I see you have no reservations about that. :-)

@skurfer

I think the main problem is that you can just hit ↩ without anything in the third pane, in which case, the action does nothing. I think this should be changed to <false/>.

@skurfer
Quicksilver OS X member

I'll test this out over the next couple of days. All looks good except my one comment on the plist.

Sorry about all the leaky strings. I try to stay away from CoreFoundation, and maybe I should. :-)

@skurfer
Quicksilver OS X member

Oh, what about removing line 66 (an unused integer) from NSArray_BLTRExtensions.m?

@skurfer
Quicksilver OS X member

Better. It's not limiting the third pane to folders, but that has nothing to do with the changes here.

@tiennou
Quicksilver OS X member

Hmm, I can't see the integer in NSArray_BLTRExensions.m so I'll assume it was already fixed.

I think the -closeFile: issue is because you can't -closeFile: in -finalize because you aren't guaranteed that it will be called on the same thread that created the NDResourceFork, and not doing so would make the behavior under GC different that the normal, which is a bad idea. Now since GC is deprecated, I don't care about behavioral differences for something we will have to drop too because of deprecation anyway ;-).

@skurfer
Quicksilver OS X member

It's not limiting the third pane to folders

I talked to @pjrobertson about this and the plist setting only affects the results of right-arrowing into something. To control the initial list, you still need to mention the action in validIndirectObjectsForAction:directObject:. I think in this case, it should act just like Move/Copy, so you could just add a check for QSCommandSaveAction to line 338.

When checking on this, I noticed that QSCommandSaveAction is tested in QSCommand.m. That doesn't seem right.

@skurfer
Quicksilver OS X member

Hmm, I can't see the integer in NSArray_BLTRExensions.m so I'll assume it was already fixed.

Weird. It appears to still be there.

@tiennou
Quicksilver OS X member

Oh yeah I got it, it appeared in da3dea7, and this branch is upstream from that so I can't fix it from there without merging in master in here... I'm still wondering at what happens if you rebase a branch from a pull request and push-force it here ;-).

@skurfer
Quicksilver OS X member

Oh yeah I got it, it appeared in da3dea7, and this branch is upstream from that so I can't fix it from there without merging in master in here

OK, I'll just do it on one of my open pull requests. Thanks.

I'm still wondering at what happens if you rebase a branch from a pull request and push-force it here ;-).

Everything I've read implies that would be a bad idea, but if it worked, it sure would be a handy trick. :-) Maybe something to try on a bogus "test" pull request.

@pjrobertson
Quicksilver OS X member

Great, looks good :)

@skurfer skurfer merged commit 09c9243 into quicksilver:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 16, 2012
  1. @tiennou

    -[QSTrigger disable]

    tiennou committed
Commits on Sep 17, 2012
  1. @tiennou
  2. @tiennou

    Remove an unnecessary copy.

    tiennou committed
  3. @tiennou

    Warning fix frenzy.

    tiennou committed
  4. @tiennou
  5. @tiennou

    Parse file: URLs.

    tiennou committed
    Fixes #840 (partly, the second part needs more heavy-lifting).
  6. @tiennou

    Memory leaks.

    tiennou committed
  7. @tiennou

    Rename a selector to appease the analyzer.

    tiennou committed
    Also change two informal protocols to formal ones.
  8. @tiennou

    Leaked strings.

    tiennou committed
  9. @tiennou
  10. @tiennou
  11. @tiennou

    Kill a spurious NSLog

    tiennou committed
  12. @tiennou
Commits on Sep 18, 2012
  1. @tiennou
  2. @tiennou

    Another leak.

    tiennou committed
View
2 Quicksilver/Code-App/QSTriggersPrefPane.m
@@ -133,7 +133,7 @@ - (void)populateTypeMenu {
id groupItem = nil;
for(NSString *key in managers) {
manager = [managers objectForKey:key];
- item = [[[NSMenuItem alloc] initWithTitle:[manager name] action:NULL keyEquivalent:@""] autorelease];
+ item = [[[NSMenuItem alloc] initWithTitle:[(QSTriggerManager *)manager name] action:NULL keyEquivalent:@""] autorelease];
[item setRepresentedObject:key];
[item setImage:[manager image]];
// [item setAction:@selector(addTrigger:)];
View
10 Quicksilver/Code-External/LaunchAtLoginController/LaunchAtLoginController.m
@@ -46,10 +46,12 @@ void sharedFileListDidChange(LSSharedFileListRef inList, void *context)
- (id) init
{
- [super init];
- loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
- LSSharedFileListAddObserver(loginItems, CFRunLoopGetMain(),
- (CFStringRef)NSDefaultRunLoopMode, sharedFileListDidChange, self);
+ self = [super init];
+ if (self) {
+ loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
+ LSSharedFileListAddObserver(loginItems, CFRunLoopGetMain(),
+ (CFStringRef)NSDefaultRunLoopMode, sharedFileListDidChange, self);
+ }
return self;
}
View
2 Quicksilver/Code-External/NDClasses/NDAlias.m
@@ -444,7 +444,7 @@ - (NSString *)description
*/
- (NSString *)debugDescription
{
- NSString * str = [NSString stringWithFormat:@"aliasHandle %p, changed %d, mountFlags %x, lastKnownPath %@",
+ NSString * str = [NSString stringWithFormat:@"aliasHandle %p, changed %d, mountFlags %lx, lastKnownPath %@",
aliasHandle,
changed,
mountFlags,
View
2 Quicksilver/Code-External/NDClasses/NDKeyboardLayout.m
@@ -348,8 +348,8 @@ - (id)initWithInputSource:(TISInputSourceRef)aSource
CFRetain( keyboardLayoutData );
else
{
- self = nil;
[self release];
+ self = nil;
}
}
return self;
View
3 Quicksilver/Code-External/NDClasses/NDResourceFork.m
@@ -206,10 +206,7 @@ - (void)closeFile
- (void)dealloc
{
if( fileReference > 0 )
- {
[self closeFile];
- NSLog (@"NDAlias ERROR: you neglected to call closeFile: before disposing this NDResourceFork");
- }
[super dealloc];
}
View
5 Quicksilver/Code-QuickStepCore/QSAction.m
@@ -392,10 +392,9 @@ - (BOOL)loadIconForObject:(QSObject *)object {
NSString *name = [[object objectForType:QSActionType] objectForKey:kActionIcon];
if (!icon && name)
icon = [QSResourceManager imageNamed:name inBundle:[object bundle]];
- if(!icon) {
- if ([object respondsToSelector:@selector(provider)]) {
+ if(!icon && [object respondsToSelector:@selector(provider)]) {
NSObject <QSActionProvider> *provider = [(QSAction*)object provider];
- if(provider && [provider respondsToSelector:@selector(iconForAction:)])
+ if(provider && [provider respondsToSelector:@selector(iconForAction:)]) {
icon = [provider iconForAction:[object identifier]];
}
}
View
2 Quicksilver/Code-QuickStepCore/QSObject.m
@@ -350,7 +350,7 @@ - (NSString *)displayName {
- (NSString *)toolTip {
#ifdef DEBUG
- return [NSString stringWithFormat:@"%@ (%d) \r%@\rTypes:\r\t%@", [self name] , self, [self details] , [[self decodedTypes] componentsJoinedByString:@"\r\t"]];
+ return [NSString stringWithFormat:@"%@ (%p) \r%@\rTypes:\r\t%@", [self name] , self, [self details] , [[self decodedTypes] componentsJoinedByString:@"\r\t"]];
#endif
return nil; //[self displayName];
}
View
2 Quicksilver/Code-QuickStepCore/QSObjectFormatter.m
@@ -12,7 +12,7 @@ - (BOOL)getObjectValue:(id *)obj forString:(NSString *)string errorDescription:(
return YES;
}
- (NSString *)stringForObjectValue:(id)anObject {
- return [anObject name];
+ return [(QSObject *)anObject name];
}
@skurfer Quicksilver OS X member
skurfer added a note

Why can't we just tell this method to expect a QSObject instead of id?

@tiennou Quicksilver OS X member
tiennou added a note

I was shoddy of changing the interface mainly ;-). But yeah, it doesn't really matter so I'll change the signature instead.

@tiennou Quicksilver OS X member
tiennou added a note

And now I become doubtful ;-). It's only use is in a commented section in QSObjectCell. I think it might have been an attempt to modernize display of object by creating a real formatter. What do you think ?

@skurfer Quicksilver OS X member
skurfer added a note

I thought you meant this method, but you're referring to the entire class. So should we just remove it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- (NSString *)editingStringForObjectValue:(id)anObject {
return [anObject details];
View
9 Quicksilver/Code-QuickStepCore/QSObject_FileHandling.h
@@ -2,14 +2,15 @@
#import <QSCore/QSClangAnalyzer.h>
#import "QSObject.h"
-@interface QSObject (QSFileObjectCreationProtocol)
-//
-- (id)initFileObject:(QSObject *)object ofType:(NSString *)type NS_RETURNS_RETAINED;
+@protocol QSFileObjectCreationProtocol
+- (id)createFileObject:(QSObject *)object ofType:(NSString *)type;
@end
-@interface NSObject (QSFileCreatingHandlingProtocol)
+
+@protocol QSFileCreatingHandlingProtocol
- (NSData *)fileRepresentationForObject:(QSObject *)object;
- (NSString *)filenameForObject:(QSObject *)object;
@end
+
@interface QSFileSystemObjectHandler : NSObject {
NSMutableDictionary *applicationIcons;
}
View
13 Quicksilver/Code-QuickStepCore/QSObject_FileHandling.m
@@ -712,10 +712,11 @@ - (id)initWithArray:(NSArray *)paths {
NSString *uti = QSUTIOfFile(path);
id handler = [QSReg instanceForKey:uti inTable:@"QSFileObjectCreationHandlers"];
if (handler) {
- // fheckl 2011-02-25
- // XCode CLang analysis: incorrect decrement of reference count
- // because method name starts with init -> no problem
- [handler initFileObject:self ofType:uti];
+ if ([handler respondsToSelector:@selector(createFileObject:ofType:)])
+ [handler createFileObject:self ofType:uti];
+ else if ([handler respondsToSelector:@selector(initFileObject:ofType:)])
+ /* Try with the old selector */
+ [handler performSelector:@selector(initFileObject:ofType:) withObject:self withObject:uti];
return self;
}
} else {
@@ -810,7 +811,7 @@ - (void)getNameFromFiles {
MDItemRef mdItem = MDItemCreate(kCFAllocatorDefault, (CFStringRef)path);
if (mdItem) {
// get the actual filesystem name, in case we were passed a localized path
- newName = (NSString *)MDItemCopyAttribute(mdItem, CFSTR("kMDItemFSName"));
+ newName = [(NSString *)MDItemCopyAttribute(mdItem, kMDItemFSName) autorelease];
}
if (!newName) {
newName = [path lastPathComponent];
@@ -826,7 +827,7 @@ - (void)getNameFromFiles {
// try getting kMDItemDisplayName first
// tends to work better than `displayNameAtPath:` for things like Preference Panes
if (mdItem) {
- newLabel = (NSString *)MDItemCopyAttribute(mdItem, CFSTR("kMDItemDisplayName"));
+ newLabel = [(NSString *)MDItemCopyAttribute(mdItem, kMDItemDisplayName) autorelease];
}
if (!newLabel) {
newLabel = [manager displayNameAtPath:path];
View
4 Quicksilver/Code-QuickStepCore/QSObject_Pasteboard.m
@@ -21,9 +21,9 @@ id objectForPasteboardType(NSPasteboard *pasteboard, NSString *type) {
// writes the selected data to the general pasteboard
bool writeObjectToPasteboard(NSPasteboard *pasteboard, NSString *type, id data) {
if ([NSURLPboardType isEqualToString:type]) {
- [[NSURL URLWithString:data] writeToPasteboard:pasteboard];
- [pasteboard addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+ [pasteboard addTypes:[NSArray arrayWithObjects:NSURLPboardType, NSStringPboardType, nil] owner:nil];
[pasteboard setString:([data hasPrefix:@"mailto:"]) ?[data substringFromIndex:7] :data forType:NSStringPboardType];
+ [pasteboard setString:[data URLDecoding] forType:NSURLPboardType];
} else if ([PLISTTYPES containsObject:type] || [data isKindOfClass:[NSDictionary class]] || [data isKindOfClass:[NSArray class]])
[pasteboard setPropertyList:data forType:type];
else if ([data isKindOfClass:[NSString class]])
View
11 Quicksilver/Code-QuickStepCore/QSObject_StringHandling.m
@@ -47,6 +47,7 @@ @implementation QSObject (StringHandling)
+ (id)objectWithString:(NSString *)string { return [[(QSObject *)[QSObject alloc] initWithString:string] autorelease]; }
- (id)initWithString:(NSString *)string {
if (![string length]) {
+ [self release];
return nil;
}
if (self = [self init]) {
@@ -110,6 +111,16 @@ - (void)sniffString {
}
return;
}
+ // It's a file URL
+ if ([stringValue hasPrefix:@"file://"]) {
+ NSURL *fileURL = [NSURL URLWithString:stringValue];
+ if ([[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]) {
+ [self setObject:[fileURL path] forType:QSFilePathType];
+ [self setPrimaryType:QSFilePathType];
+ [self getNameFromFiles];
+ return;
+ }
+ }
// trimWhitespace calls a CFStringTrimWhitespace to remove whitespace from start and end of string
stringValue = [stringValue trimWhitespace];
View
6 Quicksilver/Code-QuickStepCore/QSPlugIn.m
@@ -131,7 +131,7 @@ - (NSString *)name {
#ifdef DEBUG
if (!data) {
- name = [name stringByAppendingFormat:@" - Private", 0x03B1];
+ name = [name stringByAppendingFormat:@" - Private"];
}
if ([self isSecret]) {
name = [name stringByAppendingFormat:@" - Secret"];
@@ -144,8 +144,8 @@ - (NSString *)name {
- (NSString *)statusBullet {
if ([self isLoaded]) {
if ([bundle isLoaded])
- return [NSString stringWithFormat:@"%C", 0x25C6];
- else return [NSString stringWithFormat:@"%C", 0x25C7];
+ return [NSString stringWithFormat:@"%C", (unichar)0x25C6];
+ else return [NSString stringWithFormat:@"%C", (unichar)0x25C7];
//BOOL selected = [[aTableView selectedRowIndexes] containsIndex:rowIndex];
//[aCell setTextColor:(! && !selected?[NSColor blueColor] :[NSColor blackColor])];
//
View
4 Quicksilver/Code-QuickStepCore/QSTrigger.m
@@ -246,6 +246,10 @@ - (BOOL)enabled {
return [[info objectForKey:@"enabled"] boolValue];
}
+- (void)disable {
+ [self setEnabled:NO];
+}
+
- (void)setEnabled:(BOOL)enabled {
[info setObject:[NSNumber numberWithBool:enabled] forKey:@"enabled"];
enabled ? [[self manager] enableTrigger:self] : [[self manager] disableTrigger:self];
View
1 Quicksilver/Code-QuickStepCore/QSTriggerManager.m
@@ -68,6 +68,7 @@ - (NSWindow *)triggerDisplayWindowWithTrigger:(QSTrigger *)trigger {
// but that's ok since the window is released on close, so no autorelease here
return splashWindow;
}
+- (NSString *)name { return @""; }
@end
@implementation QSGroupTriggerManager
View
2 Quicksilver/Code-QuickStepFoundation/NSApplication_BLTRExtensions.m
@@ -171,7 +171,7 @@ + (NSString *)macOSXFullVersion {
Gestalt (gestaltSystemVersionMinor, &versionMinor);
Gestalt (gestaltSystemVersionBugFix, &versionBugfix);
- return [NSString stringWithFormat:@"%i.%i.%i",versionMajor,versionMinor,versionBugfix];
+ return [NSString stringWithFormat:@"%i.%i.%i",(int)versionMajor,(int)versionMinor,(int)versionBugfix];
}
+ (SInt32)macOSXSystemVersion {
View
7 Quicksilver/Code-QuickStepFoundation/NSString_BLTRExtensions.m
@@ -161,7 +161,12 @@ - (NSString *)URLEncodingWithEncoding:(CFStringEncoding) encoding {
}
// escape embedded %-signs that don't appear to actually be escape sequences, and pre-decode the result to avoid double-encoding
- return [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef) string, CFSTR("#"), NULL, encoding) autorelease];
+ string = [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef) string, NULL, NULL, encoding) autorelease];
+ // decode the first occurence of '#' since it's valid
+ NSRange poundSymbolRange = [string rangeOfString:@"%23"];
+ if (poundSymbolRange.location != NSNotFound)
+ string = [string stringByReplacingCharactersInRange:poundSymbolRange withString:@"#"];
+ return string;
}
- (NSString *)URLEncodeValue {
View
2 Quicksilver/Code-QuickStepInterface/QSResultController.m
@@ -586,7 +586,7 @@ - (BOOL)tableView:(NSTableView *)aTableView shouldDrawRow:(NSInteger)rowIndex in
NSRectFill(clipRect);
id object = [[self currentResults] objectAtIndex:rowIndex];
- [[object name] drawInRect:clipRect withAttributes:nil];
+ [[(QSObject *)object name] drawInRect:clipRect withAttributes:nil];
return NO;
}
View
10 Quicksilver/Code-QuickStepInterface/QSSearchObjectView.m
@@ -1453,21 +1453,17 @@ - (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector
}
- (void)textDidChange:(NSNotification *)aNotification {
- NSString *string = [[[aNotification object] string] copy];
- if ([[[aNotification object] string] isEqualToString:@" "]) {
- // [(QSInterfaceController *)[[self window] windowController] shortCircuit:self];
+ NSString *string = [[aNotification object] string];
+ if ([string isEqualToString:@" "]) {
[self shortCircuit:self];
- [string release];
return;
}
[self setObjectValue:[QSObject objectWithString:string]];
- [string release];
[self setMatchedString:nil];
}
- (void)textDidEndEditing:(NSNotification *)aNotification {
- NSString *string = [[[[aNotification object] string] copy] autorelease];
- [self setObjectValue:[QSObject objectWithString:string]];
+ [self setObjectValue:[QSObject objectWithString:[[aNotification object] string]]];
[self setMatchedString:nil];
[[[self currentEditor] enclosingScrollView] removeFromSuperview];
[[self cell] setImagePosition:-1];
View
6 Quicksilver/PlugIns-Main/QSCorePlugIn/QSCorePlugIn-Info.plist
@@ -1459,8 +1459,10 @@
<array>
<string>qs.command</string>
</array>
- <key>indirectOptional</key>
- <true/>
+ <key>indirectTypes</key>
+ <array>
+ <string>public.folder</string>
+ </array>
<key>precedence</key>
<integer>2</integer>
<key>actionSelector</key>
Something went wrong with that request. Please try again.