Merge pull request #3686 from dumganhar/iss2087-new-event-dispatcher

Fixing crash after changing Dictionary::createWithContentOfFile() to return autorelease object. [ci skip].
This commit is contained in:
James Chen 2013-09-18 01:05:11 -07:00
commit 5a65ef7488
1 changed files with 10 additions and 8 deletions

View File

@ -307,18 +307,20 @@ std::string FileUtilsApple::getFullPathForDirectoryAndFilename(const std::string
Dictionary* FileUtilsApple::createDictionaryWithContentsOfFile(const std::string& filename)
{
std::string fullPath = fullPathForFilename(filename);
NSString* pPath = [NSString stringWithUTF8String:fullPath.c_str()];
NSDictionary* pDict = [NSDictionary dictionaryWithContentsOfFile:pPath];
NSString* path = [NSString stringWithUTF8String:fullPath.c_str()];
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfFile:path];
if (pDict != nil)
if (dict != nil)
{
Dictionary* pRet = Dictionary::create();
for (id key in [pDict allKeys]) {
id value = [pDict objectForKey:key];
addValueToDict(key, value, pRet);
auto ret = new Dictionary();
ret->init();
for (id key in [dict allKeys]) {
id value = [dict objectForKey:key];
addValueToDict(key, value, ret);
}
return pRet;
return ret;
}
else
{