Re: Confusion about release mode in Xcode

2019-09-25 Thread Quincey Morris via Cocoa-dev
On Sep 25, 2019, at 14:44 , Gabriel Zachmann via Cocoa-dev wrote: > > I have tried to create a new scheme, then changed the Build Configuration to > "Release". > But in > Build Phases ⟶ Copy Files > it still says that the product is copied from ... build/Debug. > (The destination is

Re: Questions regarding release

2019-09-25 Thread Quincey Morris via Cocoa-dev
On Sep 25, 2019, at 13:52 , Rob Petrovec via Cocoa-dev wrote: > >> Is the IOObjectRelease() right or wrong ? > I’m not entirely sure since I can’t find the docs for > IOServicePortFromCGDisplayID. Given that the code fragment shows it as a message being sent to “self”, this looks like

CGImageSourceCopyPropertiesAtIndex fails sometimes

2019-09-25 Thread Gabriel Zachmann via Cocoa-dev
I have this piece of code in my program: CGImageSourceRef sourceRef = CGImageSourceCreateWithURL( (CFURLRef) url, NULL ); if ( sourceRef == NULL ) { ... display error message 1 return; } CFDictionaryRef fileProps = CGImageSourceCopyPropertiesAtIndex(

Re: CGImageSourceCopyPropertiesAtIndex fails sometimes

2019-09-25 Thread Gary L. Wade via Cocoa-dev
I don’t recall if the URL can be a remote URL in addition to a file URL, but regardless, check the status of the source ref with CGImageSourceStatus first. The index value is used for compound images like animated GIFs and PNGs. -- Gary L. Wade http://www.garywade.com/ > On Sep 25, 2019, at

Re: NSMenuItem : acceptsFirstMouse(forEvent: NSEvent)

2019-09-25 Thread Mark Wade via Cocoa-dev
Had to override acceptsFirstMouse in NSDatePicker not NSMenuItem. Works, still doesn’t highlight the fields when selected but works. Guess I’ll figure it out. Would like to know what is different when run directly and when run from Xcode though > On Sep 24, 2019, at 1:23 PM, Mark Wade via

How to have users select a directory

2019-09-25 Thread Gabriel Zachmann via Cocoa-dev
I am looking for a nice, intuitive way to let users select a directory. Right now, I have a simple TextField in my GUI that shows the current path, and a simple Button next to it that says "Change". When users click on it, it opens an NSOpenPanel that is runModal. This works fine, but I am

Questions regarding release

2019-09-25 Thread Gabriel Zachmann via Cocoa-dev
A few years ago, I switched my code to ARC. Now, I have this in my code: CGImageRef imageRef = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL ); ... NSImage * nsimage = [self convertToNSImage: img withOrientation: img_orientation]; assign nsimage to a layer ...

Re: Questions regarding release

2019-09-25 Thread Rob Petrovec via Cocoa-dev
> On Sep 25, 2019, at 2:52 PM, Rob Petrovec via Cocoa-dev > wrote: > >> Is it safe to do it after assigning the nsimage to the layer, but before >> deleting the layer? > I would think so, but it is hard to say without knowing what > convertToNSImage:withOrientation actually does under

Re: Questions regarding release

2019-09-25 Thread Rob Petrovec via Cocoa-dev
> Is it safe to do it after assigning the nsimage to the layer, but before > deleting the layer? I would think so, but it is hard to say without knowing what convertToNSImage:withOrientation actually does under the hood. It likely either retains or copies it. In either case, your

Re: Questions regarding release

2019-09-25 Thread Wim Lewis via Cocoa-dev
On Sep 25, 2019, at 12:31 PM, Gabriel Zachmann via Cocoa-dev wrote: > The doc for CGImageSourceCreateImageAtIndex() that I need to release imageRef > myself. > Is it safe to do it after assigning the nsimage to the layer, but before > deleting the layer? Yes, the NSImage will

Confusion about release mode in Xcode

2019-09-25 Thread Gabriel Zachmann via Cocoa-dev
I haven't released my software (screensaver) in many years, so please bear with me, I am not up-to-date any more how this works. I have tried to create a new scheme, then changed the Build Configuration to "Release". But in Build Phases ⟶ Copy Files it still says that the product is copied