Do I need to retain the contextInfo for NSAlert alertDidEnd?

393 views Asked by At

I need to pass an NSDictionary with a couple of options to

NSAlert - (void)beginSheetModalForWindow:(NSWindow *)window modalDelegate:(id)modalDelegate didEndSelector:(SEL)alertDidEndSelector contextInfo:(void *)contextInfo

The docs don't say anything about if the contextInfo has to be retained or not. Right now I'm retaining it before showing the alert and releasing it in alertDidEnd:, but it would be nice to know for sure if that is necessary.

1

There are 1 answers

0
DarkDust On BEST ANSWER

Since contextInfo is considered to be a "raw" C pointer (void *) and can be anything, it's your responsibility to manage memory (if you're passing an Objective-C object: to retain it).