# juce\_mac\_FileChooser.mm from tip

**URL:** <https://forum.juce.com/t/juce-mac-filechooser-mm-from-tip/3008>\
**Category:** MacOSX and iOS\
**Created:** [July 8, 2008, 4:38pm UTC](https://forum.juce.com/t/juce-mac-filechooser-mm-from-tip/3008 "2008-07-08T16:38:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaydee](https://avatars.discourse-cdn.com/v4/letter/j/ee7513/32.png) [@jaydee](https://forum.juce.com/u/jaydee)\
**Post date:** [July 8, 2008, 4:38pm UTC](https://forum.juce.com/t/juce-mac-filechooser-mm-from-tip/3008/1 "2008-07-08T16:38:27Z")

</div>

Hey Julian, just checked out the new FileChooser, looks good, but a small suggestion…

There may be times(from what I can tell quickly) that an autorelease pool may not be in place. (Plugins and a CFRunLoop)

So i’d suggest at the head of showPlatformDialog

NSAutoreleasePool \*releasePool=[[NSAutorelease Pool]alloc]init];

and at the end

[releasePool release];

This’ll take care of your [delegate autorelease] and the autoreleased [NSSavePanel savePanel] / [NSOpenPanel openPanel] and stop warnings to the console if an Autorelease Pool isn’t in place…

(See Listing 1)

[http://developer.apple.com/documentation/Cocoa/Conceptual/CarbonCocoaDoc/Articles/CocoaInCarbon.html](http://developer.apple.com/documentation/Cocoa/Conceptual/CarbonCocoaDoc/Articles/CocoaInCarbon.html)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [July 8, 2008, 5:26pm UTC](https://forum.juce.com/t/juce-mac-filechooser-mm-from-tip/3008/2 "2008-07-08T17:26:16Z")

</div>

Ah yes, I hadn’t considered that it might be called from a plugin… Ok, good suggestion!
