Merge pull request #2851 from dumganhar/master

issue #2271: Fixing some memory leaks. [VS2012] Updating project dependence and warning fixes.
This commit is contained in:
James Chen 2013-06-09 21:01:37 -07:00
commit e9f3913766
13 changed files with 35 additions and 34 deletions

View File

@ -14,6 +14,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "cocos2dx\proj
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "scripting\lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "scripting\lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection EndProjectSection

View File

@ -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
*/ */

View File

@ -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:

View File

@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -1400,11 +1400,11 @@ void ActionMoveStacked::runActionsInSprite(CCSprite *sprite)
sprite->runAction( sprite->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,10)), CCMoveBy::create(0.05f, ccp(10,10)),
CCMoveBy::create(0.05, ccp(-10,-10)), CCMoveBy::create(0.05f, ccp(-10,-10)),
NULL))); NULL)));
CCMoveBy* action = CCMoveBy::create(2, ccp(400,0)); CCMoveBy* action = CCMoveBy::create(2.0f, ccp(400,0));
CCMoveBy* action_back = (CCMoveBy*)action->reverse(); CCMoveBy* action_back = (CCMoveBy*)action->reverse();
sprite->runAction( sprite->runAction(
@ -1426,11 +1426,11 @@ void ActionMoveJumpStacked::runActionsInSprite(CCSprite *sprite)
sprite->runAction( sprite->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,2)), CCMoveBy::create(0.05f, ccp(10,2)),
CCMoveBy::create(0.05, ccp(-10,-2)), CCMoveBy::create(0.05f, ccp(-10,-2)),
NULL))); NULL)));
CCJumpBy* jump = CCJumpBy::create(2, ccp(400,0), 100, 5); CCJumpBy* jump = CCJumpBy::create(2.0f, ccp(400,0), 100, 5);
CCJumpBy* jump_back = (CCJumpBy*)jump->reverse(); CCJumpBy* jump_back = (CCJumpBy*)jump->reverse();
sprite->runAction( sprite->runAction(
@ -1465,8 +1465,8 @@ void ActionMoveBezierStacked::runActionsInSprite(CCSprite *sprite)
sprite->runAction( sprite->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,0)), CCMoveBy::create(0.05f, ccp(10,0)),
CCMoveBy::create(0.05, ccp(-10,0)), CCMoveBy::create(0.05f, ccp(-10,0)),
NULL))); NULL)));
} }
@ -1516,8 +1516,8 @@ void ActionCatmullRomStacked::onEnter()
m_tamara->runAction( m_tamara->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,0)), CCMoveBy::create(0.05f, ccp(10,0)),
CCMoveBy::create(0.05, ccp(-10,0)), CCMoveBy::create(0.05f, ccp(-10,0)),
NULL))); NULL)));
@ -1548,8 +1548,8 @@ void ActionCatmullRomStacked::onEnter()
m_kathia->runAction( m_kathia->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,0)), CCMoveBy::create(0.05f, ccp(10,0)),
CCMoveBy::create(0.05, ccp(-10,0)), CCMoveBy::create(0.05f, ccp(-10,0)),
NULL))); NULL)));
@ -1626,8 +1626,8 @@ void ActionCardinalSplineStacked::onEnter()
m_tamara->runAction( m_tamara->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,0)), CCMoveBy::create(0.05f, ccp(10,0)),
CCMoveBy::create(0.05, ccp(-10,0)), CCMoveBy::create(0.05f, ccp(-10,0)),
NULL))); NULL)));
@ -1649,8 +1649,8 @@ void ActionCardinalSplineStacked::onEnter()
m_kathia->runAction( m_kathia->runAction(
CCRepeatForever::create( CCRepeatForever::create(
CCSequence::create( CCSequence::create(
CCMoveBy::create(0.05, ccp(10,0)), CCMoveBy::create(0.05f, ccp(10,0)),
CCMoveBy::create(0.05, ccp(-10,0)), CCMoveBy::create(0.05f, ccp(-10,0)),
NULL))); NULL)));

View File

@ -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()

View File

@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -19,7 +19,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -15,7 +15,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -21,7 +21,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -23,7 +23,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
CCScriptEngineManager::sharedManager()->purgeSharedManager(); CCScriptEngineManager::purgeSharedManager();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()