Revert memory leak commits
5f7001e: "Added a new branch"01456ed: "Fixed a lot of memory leaks"dac4493: "Fixed all remaining memory leaks that I could figure out"0792db7: "Removed the smnew macro and the call to _CrtSetDbgFlag()" Some of these caused destructor-time problems due to static initialization order fiasco and related issues. Notably, the program would no longer exit on OSX and had to be killed. There were probably legitimate fixes in here, but since these are monolithic commits it's too much work to extract them now. Let's reapply them individually and in the forward direction.
This commit is contained in:
+5
-12
@@ -5,25 +5,18 @@
|
||||
#include "Foreach.h"
|
||||
|
||||
#include "SubscriptionManager.h"
|
||||
|
||||
SubscriptionManager<LuaBinding> & GetBindingSubscribers()
|
||||
{
|
||||
static SubscriptionManager<LuaBinding> subscribers;
|
||||
return subscribers;
|
||||
}
|
||||
static SubscriptionManager<LuaBinding> m_Subscribers;
|
||||
|
||||
namespace
|
||||
{
|
||||
void RegisterTypes( lua_State *L )
|
||||
{
|
||||
SubscriptionManager<LuaBinding> & subscribers = GetBindingSubscribers();
|
||||
|
||||
if( subscribers.m_pSubscribers.empty() )
|
||||
if( m_Subscribers.m_pSubscribers == NULL )
|
||||
return;
|
||||
|
||||
/* Register base classes first. */
|
||||
map<RString, LuaBinding *> mapToRegister;
|
||||
FOREACHS( LuaBinding*, subscribers.m_pSubscribers, p )
|
||||
FOREACHS( LuaBinding*, *m_Subscribers.m_pSubscribers, p )
|
||||
mapToRegister[(*p)->GetClassName()] = (*p);
|
||||
|
||||
set<RString> setRegisteredAlready;
|
||||
@@ -66,12 +59,12 @@ REGISTER_WITH_LUA_FUNCTION( RegisterTypes );
|
||||
|
||||
LuaBinding::LuaBinding()
|
||||
{
|
||||
GetBindingSubscribers().Subscribe( this );
|
||||
m_Subscribers.Subscribe( this );
|
||||
}
|
||||
|
||||
LuaBinding::~LuaBinding()
|
||||
{
|
||||
GetBindingSubscribers().Unsubscribe( this );
|
||||
m_Subscribers.Unsubscribe( this );
|
||||
}
|
||||
|
||||
void LuaBinding::Register( lua_State *L )
|
||||
|
||||
Reference in New Issue
Block a user