This code is leaking...
This code is leaking...
- Subject: This code is leaking...
- From: Tony Cate <email@hidden>
- Date: Sun, 19 Jun 2011 10:29:08 -0400
- (NSImage *)illustration
{
if ( illustrationData != nil ){
NSImage* thisImage = [NSImage new];
NSBitmapImageRep* bitmapImageRep = [[NSBitmapImageRep alloc]
initWithData:illustrationData];
NSPICTImageRep* pictImageRep = [[NSPICTImageRep alloc]
initWithData:illustrationData];
if ( bitmapImageRep != nil ){
NSLog(@"bitmapImageRep retainCount", [bitmapImageRep
retainCount]);
[thisImage addRepresentation:bitmapImageRep];
NSLog(@"bitmapImageRep retainCount", [bitmapImageRep
retainCount]);
[bitmapImageRep release];
NSLog(@"bitmapImageRep retainCount", [bitmapImageRep
retainCount]);
}
if ( pictImageRep != nil ){
[thisImage addRepresentation:pictImageRep];
[pictImageRep release];
}
return thisImage;
}
return nil;
}
The logs look like this:
2011-06-19 09:42:49.817 MyTestApp[92772:903] thisBitmapImageRep
retainCount: 2
2011-06-19 09:42:49.820 MyTestApp[92772:903] thisBitmapImageRep
retainCount: 3
2011-06-19 09:42:49.822 MyTestApp[92772:903] thisBitmapImageRep
retainCount: 2
bitmapImageRep is leaking. Why is the retain count 2 after the
initWithData:? Should I file a bug?
Tony
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden