Equip any new threads with an NSAutoreleasePool.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6978 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-01-29 23:46:26 +00:00
parent 2e4fae2b80
commit 2de8742368
3 changed files with 10 additions and 32 deletions

View File

@ -18,6 +18,10 @@
#define USE_RVALUE_REFERENCES #define USE_RVALUE_REFERENCES
#endif #endif
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
#if defined(_WIN32) #if defined(_WIN32)
// WIN32 // WIN32
@ -256,9 +260,14 @@ private:
template <typename F> template <typename F>
static THREAD_RETURN RunAndDelete(void* param) static THREAD_RETURN RunAndDelete(void* param)
{ {
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
static_cast<F*>(param)->Run(); static_cast<F*>(param)->Run();
delete static_cast<F*>(param); delete static_cast<F*>(param);
#ifdef __APPLE__
[pool release];
#endif
return 0; return 0;
} }
}; };

View File

@ -20,10 +20,6 @@
#include <windows.h> #include <windows.h>
#endif #endif
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
#include "Setup.h" // Common #include "Setup.h" // Common
#include "Atomic.h" #include "Atomic.h"
#include "Thread.h" #include "Thread.h"
@ -250,10 +246,6 @@ void Stop() // - Hammertime!
void CpuThread() void CpuThread()
{ {
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
CPluginManager &Plugins = CPluginManager::GetInstance(); CPluginManager &Plugins = CPluginManager::GetInstance();
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -292,9 +284,6 @@ void CpuThread()
cpuRunloopQuit.Set(); cpuRunloopQuit.Set();
#ifdef __APPLE__
[pool release];
#endif
return; return;
} }
@ -303,10 +292,6 @@ void CpuThread()
// Call browser: Init():g_EmuThread(). See the BootManager.cpp file description for a complete call schedule. // Call browser: Init():g_EmuThread(). See the BootManager.cpp file description for a complete call schedule.
void EmuThread() void EmuThread()
{ {
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
Host_UpdateMainFrame(); // Disable any menus or buttons at boot Host_UpdateMainFrame(); // Disable any menus or buttons at boot
cpuRunloopQuit.Init(); cpuRunloopQuit.Init();
@ -492,10 +477,6 @@ void EmuThread()
cpuRunloopQuit.Shutdown(); cpuRunloopQuit.Shutdown();
g_bStopping = false; g_bStopping = false;
#ifdef __APPLE__
[pool release];
#endif
} }
// Set or get the running state // Set or get the running state

View File

@ -28,10 +28,6 @@
#include "../WiimoteEmu/WiimoteHid.h" #include "../WiimoteEmu/WiimoteHid.h"
#ifdef __APPLE__
#import <Foundation/NSAutoreleasePool.h>
#endif
unsigned int g_wiimote_sources[MAX_WIIMOTES]; unsigned int g_wiimote_sources[MAX_WIIMOTES];
namespace WiimoteReal namespace WiimoteReal
@ -308,10 +304,6 @@ void Wiimote::StartThread(Wiimote *wiimote)
void Wiimote::ThreadFunc() void Wiimote::ThreadFunc()
{ {
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
char thname[] = "Wiimote # Thread"; char thname[] = "Wiimote # Thread";
thname[8] = (char)('1' + index); thname[8] = (char)('1' + index);
Common::SetCurrentThreadName(thname); Common::SetCurrentThreadName(thname);
@ -335,10 +327,6 @@ void Wiimote::ThreadFunc()
} }
Host_ConnectWiimote(index, false); Host_ConnectWiimote(index, false);
#ifdef __APPLE__
[pool release];
#endif
} }
#ifndef _WIN32 #ifndef _WIN32