From 0bfd934d033cad5e8003c968a0ba72ae0878f130 Mon Sep 17 00:00:00 2001 From: xseekerj Date: Sat, 27 Sep 2014 19:53:44 +0800 Subject: [PATCH] CCPlatformMacros.h Added std::nothrow for CREATE_FUNC. --- cocos/platform/CCPlatformMacros.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cocos/platform/CCPlatformMacros.h b/cocos/platform/CCPlatformMacros.h index 455f7c0cf2..a4769135dc 100644 --- a/cocos/platform/CCPlatformMacros.h +++ b/cocos/platform/CCPlatformMacros.h @@ -31,6 +31,7 @@ Copyright (c) 2013-2014 Chukong Technologies #include "base/ccConfig.h" #include "platform/CCPlatformConfig.h" #include "platform/CCPlatformDefine.h" +#include /** * define a create function for a specific type, such as Layer @@ -39,7 +40,7 @@ Copyright (c) 2013-2014 Chukong Technologies #define CREATE_FUNC(__TYPE__) \ static __TYPE__* create() \ { \ - __TYPE__ *pRet = new __TYPE__(); \ + __TYPE__ *pRet = new(std::nothrow) __TYPE__(); \ if (pRet && pRet->init()) \ { \ pRet->autorelease(); \ @@ -61,7 +62,7 @@ static __TYPE__* create() \ #define NODE_FUNC(__TYPE__) \ CC_DEPRECATED_ATTRIBUTE static __TYPE__* node() \ { \ - __TYPE__ *pRet = new __TYPE__(); \ + __TYPE__ *pRet = new(std::nothrow) __TYPE__(); \ if (pRet && pRet->init()) \ { \ pRet->autorelease(); \