Crash #1401

Closed
wants to merge 11 commits into
from

Projects

None yet

3 participants

@pjrobertson
Member

Fixes the crash discussed on the dev groups

@tiennou tiennou and 1 other commented on an outdated diff Feb 20, 2013
Quicksilver/Code-QuickStepCore/QSObject.m
@@ -748,11 +746,8 @@ - (NSString *)label {
if (label)
return label;
- label = [meta objectForKey:kQSObjectAlternateName];
- if (label)
- return label;
-
- return nil;
+ label = [[meta objectForKey:kQSObjectAlternateName] retain];
@pjrobertson
pjrobertson Feb 20, 2013 Member

why's this a leak?

this line is only ever called if label == nil, and as such, there's nothing to release

@tiennou
tiennou Feb 20, 2013 Member

Hmm, yeah. This ivar looked to me like a local variable, so I was misled into thinking it's a unbalanced retain (sometimes those diffs really miss context). The return line below should read return [[label retain] autorelease] though. The one above should to the same ;-).

Here's how I'd write it :

- (NSString *)label {
    if (!label)
        label = [[meta objectForKey:kQSObjectAlternateName] retain];

    return [[label retain] autorelease];
}
@tiennou
Member
tiennou commented Feb 20, 2013

Just a thought, we should nil the ivars in dealloc too.

@tiennou
Member
tiennou commented Feb 20, 2013

Also, most of those accessors aren't thread-safe (they lack @synchronized(self)). I know there's duplication between ivars and data/meta but maybe we could take the time to straighten all this ?

@pjrobertson
Member

I've pushed a cleaner getter.

@pjrobertson
Member

After making the QSPureStringRanking changes, my searching/mnemonics were up the spout. So clearly it is used for something. I've reverted that commit.

@skurfer
Member
skurfer commented Feb 21, 2013

Closing this, as I'm going to merge it manually.

@skurfer skurfer closed this Feb 21, 2013
@pjrobertson
Member

Can you delete this branch when you're done as well (I don't want to do it incase you haven't cherry-picked yet)

Ta

@skurfer skurfer added a commit that referenced this pull request Feb 21, 2013
@skurfer skurfer mention #1401 in the release notes fed7784
@skurfer
Member

I'm troubleshooting a weird problem that this introduced. Still looking into it, but for at least one proxy object (maybe all of them) the noIdentifier flag is YES, causing the identifier method to always return nil and breaking mnemonics. Just FYI. I'll probably figure it out before you see this. :-)

Member

Got it. Pull request after lunch.

Member
@pjrobertson pjrobertson deleted the crash branch Feb 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment