Add an auto-release pool wrapper to the Cocoa code
Hopefully this will address some warnings seen on Mac
This commit is contained in:
parent
05588c2ee4
commit
1632c5b266
1 changed files with 21 additions and 0 deletions
|
@ -110,6 +110,23 @@ static void setItemShortcutFromString(NSMenuItem* item, const string& s)
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
class CocoaAutoreleasePool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CocoaAutoreleasePool()
|
||||||
|
{
|
||||||
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
}
|
||||||
|
|
||||||
|
~CocoaAutoreleasePool()
|
||||||
|
{
|
||||||
|
[pool release];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
NSAutoreleasePool* pool;
|
||||||
|
};
|
||||||
|
|
||||||
class CocoaEnabledListener : public SGPropertyChangeListener
|
class CocoaEnabledListener : public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -120,6 +137,7 @@ namespace {
|
||||||
|
|
||||||
virtual void valueChanged(SGPropertyNode *node)
|
virtual void valueChanged(SGPropertyNode *node)
|
||||||
{
|
{
|
||||||
|
CocoaAutoreleasePool pool;
|
||||||
BOOL b = node->getBoolValue();
|
BOOL b = node->getBoolValue();
|
||||||
[item setEnabled:b];
|
[item setEnabled:b];
|
||||||
}
|
}
|
||||||
|
@ -137,6 +155,7 @@ FGCocoaMenuBar::CocoaMenuBarPrivate::CocoaMenuBarPrivate()
|
||||||
|
|
||||||
FGCocoaMenuBar::CocoaMenuBarPrivate::~CocoaMenuBarPrivate()
|
FGCocoaMenuBar::CocoaMenuBarPrivate::~CocoaMenuBarPrivate()
|
||||||
{
|
{
|
||||||
|
CocoaAutoreleasePool pool;
|
||||||
[delegate release];
|
[delegate release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,6 +246,8 @@ FGCocoaMenuBar::~FGCocoaMenuBar()
|
||||||
|
|
||||||
void FGCocoaMenuBar::init()
|
void FGCocoaMenuBar::init()
|
||||||
{
|
{
|
||||||
|
CocoaAutoreleasePool pool;
|
||||||
|
|
||||||
NSMenu* mainBar = [[NSApplication sharedApplication] mainMenu];
|
NSMenu* mainBar = [[NSApplication sharedApplication] mainMenu];
|
||||||
SGPropertyNode_ptr props = fgGetNode("/sim/menubar/default",true);
|
SGPropertyNode_ptr props = fgGetNode("/sim/menubar/default",true);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue