Re: Thread-safe atomic property for array

2015-08-15 Thread Mike Abdullah
On 15 Aug 2015, at 00:59, Trygve Inda cocoa...@xericdesign.com wrote: My main thread periodically downloads some data from a website. This is extracted into an NSArray (non-mutable) and placed in a property: @property (atomic, retain) NSArray* myArray; [self setMyArray:webArray]; Ok

Automatically activate next window after one is closed

2015-08-15 Thread Felipe Monteiro de Carvalho
Hello, I have a nib-less Cocoa application which creates 2 forms, and 1 of them is visible. Upon clicking a button in this form, it shows another form. When I close this form, the other form is not activated automatically, causing the menu to not change. Any ideas about what exactly I am

Re: Thread-safe atomic property for array

2015-08-15 Thread Jens Alfke
On Aug 15, 2015, at 6:50 AM, Sandy McGuffog mcguff...@gmail.com wrote: Well, in my experience, in multithreaded code, if you can’t guarantee that something won’t happen, sooner or later it will, so you better code around it. Murphy’s law is particularly strong as regards multithreading :)

Re: Thread-safe atomic property for array

2015-08-15 Thread Clark S. Cox III
On Aug 15, 2015, at 05:21, Sandy McGuffog mcguff...@gmail.com wrote: What guarantees that the current autorelease cycle doesn’t end in the middle of this code? Because that’s how autorelease pools work. Actually, as I think about it, technically, the [[hostObject myArray] retain]

Re: Thread-safe atomic property for array

2015-08-15 Thread Mike Abdullah
On 15 Aug 2015, at 13:21, Sandy McGuffog mcguff...@gmail.com wrote: What guarantees that the current autorelease cycle doesn’t end in the middle of this code? If it does end in the middle of this code, that’s something the author of the code is doing specially and must deal with the

Re: Thread-safe atomic property for array

2015-08-15 Thread Sandy McGuffog
Well, in my experience, in multithreaded code, if you can’t guarantee that something won’t happen, sooner or later it will, so you better code around it. Murphy’s law is particularly strong as regards multithreading :) On Aug 15, 2015, at 2:36 PM, Mike Abdullah mabdul...@karelia.com wrote:

Re: Thread-safe atomic property for array

2015-08-15 Thread Sandy McGuffog
On Aug 15, 2015, at 1:14 PM, Mike Abdullah mabdul...@karelia.com wrote: NSArray *array = [hostObject myArray]; // run your checks, etc. NSString *someString = [array objectAtIndex:2]; Just to be safe: NSArray *array = [[hostObject myArray] retain]; // run your checks, etc. NSString

Re: Thread-safe atomic property for array

2015-08-15 Thread Mike Abdullah
On 15 Aug 2015, at 13:07, Sandy McGuffog mcguff...@gmail.com wrote: On Aug 15, 2015, at 1:14 PM, Mike Abdullah mabdul...@karelia.com wrote: NSArray *array = [hostObject myArray]; // run your checks, etc. NSString *someString = [array objectAtIndex:2]; Just to be safe: NSArray

Re: Automatically activate next window after one is closed

2015-08-15 Thread Ken Thomases
On Aug 15, 2015, at 1:32 AM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: I have a nib-less Cocoa application which creates 2 forms, and 1 of them is visible. Upon clicking a button in this form, it shows another form. When I close this form, the other form is not

Re: Thread-safe atomic property for array

2015-08-15 Thread Sandy McGuffog
What guarantees that the current autorelease cycle doesn’t end in the middle of this code? Actually, as I think about it, technically, the [[hostObject myArray] retain] should be wrapped in some kind of lock mechanism itself to make it atomic…. On Aug 15, 2015, at 2:10 PM, Mike Abdullah

Re: Automatically activate next window after one is closed

2015-08-15 Thread Felipe Monteiro de Carvalho
On Sat, Aug 15, 2015 at 2:12 PM, Ken Thomases k...@codeweavers.com wrote: That's PyObjC syntax, which not everybody on this list can be expected to recognize. Actually its Objective Pascal (see http://wiki.freepascal.org/FPC_PasCocoa#Creating_and_running_application_with_one_menu_item ), but C