On OS X, add autorelease pools to the cpu and emu threads to avoid

leaking memory. This is necessary because the wxgl code called from
those threads relies on deferred release.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5792 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-26 12:52:57 +00:00
parent 67d5d89388
commit ebbfba62a0
1 changed files with 21 additions and 1 deletions

View File

@ -17,7 +17,11 @@
#ifdef _WIN32
#include <windows.h>
#include <windows.h>
#endif
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
#include "Setup.h" // Common
@ -261,6 +265,10 @@ void Stop() // - Hammertime!
THREAD_RETURN CpuThread(void *pArg)
{
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
CPluginManager &Plugins = CPluginManager::GetInstance();
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -298,6 +306,10 @@ THREAD_RETURN CpuThread(void *pArg)
}
cpuRunloopQuit.Set();
#ifdef __APPLE__
[pool release];
#endif
return 0;
}
@ -306,6 +318,10 @@ THREAD_RETURN CpuThread(void *pArg)
// Call browser: Init():g_EmuThread(). See the BootManager.cpp file description for a complete call schedule.
THREAD_RETURN EmuThread(void *pArg)
{
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
Host_UpdateMainFrame(); // Disable any menus or buttons at boot
cpuRunloopQuit.Init();
@ -522,6 +538,10 @@ THREAD_RETURN EmuThread(void *pArg)
cpuRunloopQuit.Shutdown();
g_bStopping = false;
#ifdef __APPLE__
[pool release];
#endif
return 0;
}