Bridging CFArrayRef and NSArray
Bridging CFArrayRef and NSArray
- Subject: Bridging CFArrayRef and NSArray
- From: Dave <email@hidden>
- Date: Mon, 29 Jun 2015 13:57:17 +0100
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 (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