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
Fix a possible crash when releasing a CF obj #1775
Conversation
@@ -299,7 +299,7 @@ - (NSArray *)validIndirectObjectsForAction:(NSString *)action directObject:(QSOb | |||
if ([action isEqualToString:kFileOpenWithAction]) { | |||
NSURL *fileURL = nil; | |||
// comma trick - get a list of apps based on the 1st selected file | |||
fileURL = [NSURL fileURLWithPath:[[dObject validPaths] objectAtIndex:0]]; | |||
fileURL = [NSURL fileURLWithPath:[[dObject validPaths] objectAtIndex:0]]; | |||
|
|||
CFURLRef urlRef = NULL; | |||
if (fileURL) LSGetApplicationForURL((__bridge CFURLRef) fileURL, kLSRolesAll, NULL, &urlRef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also :
NSURL *appURL = nil;
if (fileURL) {
CFURLRef urlRef = NULL;
LSGetApplicationForURL((__bridge CFURLRef) fileURL, kLSRolesAll, NULL, &urlRef);
if (urlRef) {
appURL = (__bridge_transfer NSURL*)urlRef; // Ta-daa !
}
}
Let's make ARC handle memory management, right ;-) ?
LGTM, but the indentation is wrong ;-). |
Nah, that’s what Xcode says. Ignore GitHub. It’s wrong ;-) On 12 Chwef 2014, at 01:41, Etienne Samson notifications@github.com wrote:
|
God Bless Xcode then. |
Fix a possible crash when releasing a CF obj
D’oh! You guys snuck this in while I wasn’t paying attention. 😃 It’s included in today’s dev preview, but was not mentioned in the release notes. Not that big a deal. UpdateI’ve added it to the release notes and pushed an updated copy to qsapp.com, so it’s just the in-app release notes that will be wrong until the next preview. |
Heh, sorry about that. I think that can be called a "submarine merge" ;-). |
Great work Etienne, us Europeans foiled the Americans! ;-) On 12 Chwef 2014, at 05:01, Etienne Samson notifications@github.com wrote:
|
I think this crash just now only occurred because of a caches problem, but if you see that when
fileURL == nil
thenurlRef == NULL
. We all know that trying toCFRelease(NULL)
is bad.