Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

KnightWRX

macrumors Pentium
Original poster
Jan 28, 2009
15,046
4
Quebec, Canada
This one has me baffled honestly. Seems the autorelease pool is releasing an object twice :

Screen Shot 2012-06-04 at 7.56.59 PM.png

Now, this object is a NSString that's a property of an instance of a class. The property is declared as such :

Code:
@property (nonatomic, retain) NSString * colorSet;

Also, it says one of my Class functions is releasing this string. However, there is no release statement at all in that function, it's quite the small utility type function to begin with :

Code:
+(NSDictionary *) getColorSetNamed: (NSString *) colorSetName
{
    return csIsReady ? [colorSets objectForKey: colorSetName] : nil;
}

This is how it's being called in code if I follow the stack :

Code:
int numElements = [sprites count];
	...
	BRSprite * currentSprite;
	...
	for(int i = 0; i < numElements; i++)
	{
		currentSprite = [sprites objectAtIndex: i];
        ...  
                NSDictionary * currentColorSet = nil;
        ...
                if(currentSprite.colorSet)
                     currentColorSet = [BRColorSet getColorSetNamed: currentSprite.colorSet];

And this is how the string value was initially set in the property :

Code:
NSDictionary * colorSetConfig;
    if((colorSetConfig = [defaults objectForKey: @"colorset"]))
    {
        colorSet = [colorSetConfig objectForKey:@"default"];

I hope this is a very stupid mistake on my part. :(

EDIT : wait, could it be because I'm not using the synthesized property and thus not issuing a retain on the NSString when grabbing it from the NSDictionary in that last code block ?

EDIT2: god damn it, that was it :mad:
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.