Reputation: 2543
Could someone please explain why I get the "potential leak of an object" warning here ? I don't get it. Thank you!
-(Code) drawTo:(ContextClass *) trg
{
CGColorSpaceRef rgbColorspace = CGColorSpaceCreateDeviceRGB();
CGFloat values[4] = { getRed(colour),
getGreen(colour),
getBlue(colour), 1.0 };
trg.storedColourRef = CGColorCreate(rgbColorspace, values);
CGColorSpaceRelease(rgbColorspace);
return OK;
}
Is it because I store the object in trg.storedColourRef ? ... which is a property in a different class:
@property (nonatomic, assign) CGColorRef storedColourRef;
Upvotes: 3
Views: 237
Reputation: 9089
Yes, that's because you create Quartz color with CGColorCreate()
and pass it to some external (?) object. Compiler could not find corresponding CGColorRelease()
call that shall be used to destroy color object and therefore generates this warning.
Upvotes: 5