Re: Avoiding leaks with "initWithCGImage"

2023-08-24 Thread Rob Petrovec via Cocoa-dev
To be clear, CGImageForProposedRect doesn’t have ‘Create’ in the name. So the 'Create Rule' doesn’t apply. But it is an easy thing to overlook. —Rob > On Aug 24, 2023, at 2:35 AM, JPH wrote: > > Thanks to all of you > The CFRelease(imageRef); was the problem and the

Re: Avoiding leaks with "initWithCGImage"

2023-08-24 Thread Rob Petrovec via Cocoa-dev
ARC only affects Objective-C objects. It has no effect on CF objects like CGImageRefs, CFArrayRefs, CFDictionaryRefs etc. If you play with CF objects in an ARC app you still need to release them. You don’t need to release Obj-C objects and the compiler will warn you if you try to. —Rob >

Re: Avoiding leaks with "initWithCGImage"

2023-08-24 Thread JPH via Cocoa-dev
Thanks to all of you The CFRelease(imageRef); was the problem and the CFRelease(subImageRef); is OK My fault was then to apply the old days « Create rule » , bypassing ARC ! I was misled by Instruments/Leaks which reports a leak, which meant to me that I had to look for a missing release,