Hi,

Is the following ok for getting a CFArrayRef and retaining it until dealloc 
time? Whenever refreshGlobalWindowArray is called I want the existing copy to 
be released and the new value to be retained.

This is a Mac Project using manual memory management.

All the Best
Dave



@property (nonatomic,retain)    NSArray*                
pScriptBridgeGlobalWindowArray;

-(void) refreshGlobalWindowArray
{
NSArray*                        myGlobalWindowsArray;
CFArrayRef              myGlobalWindowArrayRef;

myGlobalWindowArrayRef = 
CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly,kCGNullWindowID);

myGlobalWindowsArray = (NSArray*) myGlobalWindowArrayRef;
self.pScriptBridgeGlobalWindowArray = myGlobalWindowsArray;

CFRelease(myGlobalWindowArrayRef);
}

-(void) dealloc 
{
self.pScriptBridgeGlobalWindowArray = nil;

[super dealloc];
}



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to