From 59a6635c7ba461f15ef938c727e806ad7fe25d4a Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 17 May 2013 09:47:31 +0800 Subject: [PATCH] issue #1859:fix compiling error of AssetsManager.cpp --- extensions/AssetsManager/AssetsManager.cpp | 11 ++++++++--- extensions/AssetsManager/AssetsManager.h | 2 +- .../proj.win32/AssetsManagerTest.vcxproj | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/extensions/AssetsManager/AssetsManager.cpp b/extensions/AssetsManager/AssetsManager.cpp index 98a6578f75..7083bd1875 100644 --- a/extensions/AssetsManager/AssetsManager.cpp +++ b/extensions/AssetsManager/AssetsManager.cpp @@ -78,7 +78,7 @@ AssetsManager::AssetsManager(const char* packageUrl/* =NULL */, const char* vers , _versionFileUrl(versionFileUrl) , _downloadedVersion("") , _curl(NULL) -, _tid(0) +, _tid(NULL) , _connectionTimeout(0) , _delegate(NULL) { @@ -186,7 +186,11 @@ void* assetsManagerDownloadAndUncompress(void *data) self->_schedule->sendMessage(msg2); } while (0); - self->_tid = 0; + if (self->_tid) + { + delete self->_tid; + self->_tid = NULL; + } return NULL; } @@ -211,7 +215,8 @@ void AssetsManager::update() // Is package already downloaded? _downloadedVersion = CCUserDefault::sharedUserDefault()->getStringForKey(KEY_OF_DOWNLOADED_VERSION); - pthread_create(&_tid, NULL, assetsManagerDownloadAndUncompress, this); + _tid = new pthread_t(); + pthread_create(&(*_tid), NULL, assetsManagerDownloadAndUncompress, this); } bool AssetsManager::uncompress() diff --git a/extensions/AssetsManager/AssetsManager.h b/extensions/AssetsManager/AssetsManager.h index 919a56aa47..c97bc0ca51 100644 --- a/extensions/AssetsManager/AssetsManager.h +++ b/extensions/AssetsManager/AssetsManager.h @@ -187,7 +187,7 @@ private: CURL *_curl; Helper *_schedule; - pthread_t _tid; + pthread_t *_tid; unsigned int _connectionTimeout; AssetsManagerDelegateProtocol *_delegate; // weak reference diff --git a/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj b/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj index dc350472af..b5b85b5448 100644 --- a/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj +++ b/samples/Cpp/AssetsManagerTest/proj.win32/AssetsManagerTest.vcxproj @@ -75,7 +75,7 @@ Disabled - $(ProjectDir)..\Classes;$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\..\extensions;$(ProjectDir)..\..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\..\cocos2dx;$(ProjectDir)..\..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(ProjectDir)..\..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\..\extensions;$(ProjectDir)..\..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\..\cocos2dx;$(ProjectDir)..\..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\..\cocos2dx\platform\third_party\win32\pthread;$(ProjectDir)..\..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true EnableFastChecks