mirror of https://github.com/axmolengine/axmol.git
issue #2271: Fixing some memory leaks.
This commit is contained in:
parent
5092755e73
commit
a14df8d28d
|
@ -39,13 +39,12 @@ class CCArmatureDataManager : public CCObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static CCArmatureDataManager *sharedArmatureDataManager();
|
static CCArmatureDataManager *sharedArmatureDataManager();
|
||||||
|
static void purgeArmatureSystem();
|
||||||
private:
|
private:
|
||||||
CCArmatureDataManager(void);
|
CCArmatureDataManager(void);
|
||||||
~CCArmatureDataManager(void);
|
~CCArmatureDataManager(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void purgeArmatureSystem();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init CCArmatureDataManager
|
* Init CCArmatureDataManager
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -222,7 +222,6 @@ void WsThreadHelper::update(float dt)
|
||||||
enum WS_MSG {
|
enum WS_MSG {
|
||||||
WS_MSG_TO_SUBTRHEAD_SENDING_STRING = 0,
|
WS_MSG_TO_SUBTRHEAD_SENDING_STRING = 0,
|
||||||
WS_MSG_TO_SUBTRHEAD_SENDING_BINARY,
|
WS_MSG_TO_SUBTRHEAD_SENDING_BINARY,
|
||||||
WS_MSG_TO_SUBTRHEAD_CLOSING,
|
|
||||||
WS_MSG_TO_UITHREAD_OPEN,
|
WS_MSG_TO_UITHREAD_OPEN,
|
||||||
WS_MSG_TO_UITHREAD_MESSAGE,
|
WS_MSG_TO_UITHREAD_MESSAGE,
|
||||||
WS_MSG_TO_UITHREAD_ERROR,
|
WS_MSG_TO_UITHREAD_ERROR,
|
||||||
|
@ -381,10 +380,6 @@ void WebSocket::close()
|
||||||
CCLOG("websocket (%p) connection closed by client", this);
|
CCLOG("websocket (%p) connection closed by client", this);
|
||||||
_readyState = kStateClosed;
|
_readyState = kStateClosed;
|
||||||
|
|
||||||
WsMessage* msg = new WsMessage();
|
|
||||||
msg->what = WS_MSG_TO_SUBTRHEAD_CLOSING;
|
|
||||||
|
|
||||||
_wsHelper->sendMessageToSubThread(msg);
|
|
||||||
_wsHelper->joinSubThread();
|
_wsHelper->joinSubThread();
|
||||||
|
|
||||||
// onClose callback needs to be invoked at the end of this method
|
// onClose callback needs to be invoked at the end of this method
|
||||||
|
@ -481,20 +476,26 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
|
||||||
case LWS_CALLBACK_PROTOCOL_DESTROY:
|
case LWS_CALLBACK_PROTOCOL_DESTROY:
|
||||||
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
|
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
|
||||||
{
|
{
|
||||||
WsMessage* msg = new WsMessage();
|
WsMessage* msg = NULL;
|
||||||
if (reason == LWS_CALLBACK_CLIENT_CONNECTION_ERROR
|
if (reason == LWS_CALLBACK_CLIENT_CONNECTION_ERROR
|
||||||
|| (reason == LWS_CALLBACK_PROTOCOL_DESTROY && _readyState == kStateConnecting)
|
|| (reason == LWS_CALLBACK_PROTOCOL_DESTROY && _readyState == kStateConnecting)
|
||||||
|| (reason == LWS_CALLBACK_DEL_POLL_FD && _readyState == kStateConnecting)
|
|| (reason == LWS_CALLBACK_DEL_POLL_FD && _readyState == kStateConnecting)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
msg = new WsMessage();
|
||||||
msg->what = WS_MSG_TO_UITHREAD_ERROR;
|
msg->what = WS_MSG_TO_UITHREAD_ERROR;
|
||||||
_readyState = kStateClosing;
|
_readyState = kStateClosing;
|
||||||
}
|
}
|
||||||
else if (reason == LWS_CALLBACK_PROTOCOL_DESTROY && _readyState == kStateClosing)
|
else if (reason == LWS_CALLBACK_PROTOCOL_DESTROY && _readyState == kStateClosing)
|
||||||
{
|
{
|
||||||
|
msg = new WsMessage();
|
||||||
msg->what = WS_MSG_TO_UITHREAD_CLOSE;
|
msg->what = WS_MSG_TO_UITHREAD_CLOSE;
|
||||||
}
|
}
|
||||||
_wsHelper->sendMessageToUIThread(msg);
|
|
||||||
|
if (msg)
|
||||||
|
{
|
||||||
|
_wsHelper->sendMessageToUIThread(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LWS_CALLBACK_CLIENT_ESTABLISHED:
|
case LWS_CALLBACK_CLIENT_ESTABLISHED:
|
||||||
|
|
|
@ -15,7 +15,7 @@ AppDelegate::AppDelegate()
|
||||||
AppDelegate::~AppDelegate()
|
AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
// SimpleAudioEngine::end();
|
// SimpleAudioEngine::end();
|
||||||
cocos2d::extension::CCArmatureDataManager::sharedArmatureDataManager()->purgeArmatureSystem();
|
cocos2d::extension::CCArmatureDataManager::purgeArmatureSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
|
@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
|
||||||
|
|
||||||
AppDelegate::~AppDelegate()
|
AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
CCScriptEngineManager::sharedManager()->purgeSharedManager();
|
CCScriptEngineManager::purgeSharedManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
|
@ -19,7 +19,7 @@ AppDelegate::AppDelegate()
|
||||||
|
|
||||||
AppDelegate::~AppDelegate()
|
AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
CCScriptEngineManager::sharedManager()->purgeSharedManager();
|
CCScriptEngineManager::purgeSharedManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
|
@ -15,7 +15,7 @@ AppDelegate::AppDelegate()
|
||||||
|
|
||||||
AppDelegate::~AppDelegate()
|
AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
CCScriptEngineManager::sharedManager()->purgeSharedManager();
|
CCScriptEngineManager::purgeSharedManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
|
@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
|
||||||
|
|
||||||
AppDelegate::~AppDelegate()
|
AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
CCScriptEngineManager::sharedManager()->purgeSharedManager();
|
CCScriptEngineManager::purgeSharedManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
|
@ -21,7 +21,7 @@ AppDelegate::AppDelegate()
|
||||||
|
|
||||||
AppDelegate::~AppDelegate()
|
AppDelegate::~AppDelegate()
|
||||||
{
|
{
|
||||||
CCScriptEngineManager::sharedManager()->purgeSharedManager();
|
CCScriptEngineManager::purgeSharedManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AppDelegate::applicationDidFinishLaunching()
|
bool AppDelegate::applicationDidFinishLaunching()
|
||||||
|
|
Loading…
Reference in New Issue