mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1656 from dumganhar/gles20
fixed #1576: CCNode::setUserObject needs to be retained.
This commit is contained in:
commit
277fefd386
|
@ -489,6 +489,8 @@ void CCNode::setGLServerState(ccGLServerState glServerState)
|
|||
|
||||
void CCNode::setUserObject(CCObject *pUserObject)
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pUserObject);
|
||||
CC_SAFE_RETAIN(pUserObject);
|
||||
m_pUserObject = pUserObject;
|
||||
}
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ public:
|
|||
|
||||
/** Similar to userData, but instead of holding a void* it holds an id */
|
||||
virtual CCObject* getUserObject();
|
||||
virtual void setUserObject(CCObject *pUserObject);
|
||||
virtual void setUserObject(CCObject *pUserObject); //retain
|
||||
|
||||
/** Shader Program
|
||||
@since v2.0
|
||||
|
|
|
@ -50,23 +50,23 @@ I found that it's not work in C++. So it keep what it's look like in version 1.0
|
|||
*/
|
||||
#define CCARRAY_FOREACH(__array__, __object__) \
|
||||
if ((__array__) && (__array__)->data->num > 0) \
|
||||
for(CCObject** arr = (__array__)->data->arr, **end = (__array__)->data->arr + (__array__)->data->num-1; \
|
||||
arr <= end && (((__object__) = *arr) != NULL/* || true*/); \
|
||||
arr++)
|
||||
for(CCObject** __arr__ = (__array__)->data->arr, **__end__ = (__array__)->data->arr + (__array__)->data->num-1; \
|
||||
__arr__ <= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \
|
||||
__arr__++)
|
||||
|
||||
#define CCARRAY_FOREACH_REVERSE(__array__, __object__) \
|
||||
if ((__array__) && (__array__)->data->num > 0) \
|
||||
for(CCObject** arr = (__array__)->data->arr + (__array__)->data->num-1, **end = (__array__)->data->arr; \
|
||||
arr >= end && (((__object__) = *arr) != NULL/* || true*/); \
|
||||
arr--)
|
||||
for(CCObject** __arr__ = (__array__)->data->arr + (__array__)->data->num-1, **__end__ = (__array__)->data->arr; \
|
||||
__arr__ >= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \
|
||||
__arr__--)
|
||||
|
||||
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
|
||||
#define CCARRAY_VERIFY_TYPE(__array__, __type__) \
|
||||
do { \
|
||||
if ((__array__) && (__array__)->data->num > 0) \
|
||||
for(CCObject** arr = (__array__)->data->arr, \
|
||||
**end = (__array__)->data->arr + (__array__)->data->num-1; arr <= end; arr++) \
|
||||
CCAssert(dynamic_cast<__type__>(*arr), "element type is wrong!"); \
|
||||
for(CCObject** __arr__ = (__array__)->data->arr, \
|
||||
**__end__ = (__array__)->data->arr + (__array__)->data->num-1; __arr__ <= __end__; __arr__++) \
|
||||
CCAssert(dynamic_cast<__type__>(*__arr__), "element type is wrong!"); \
|
||||
} while(false)
|
||||
#else
|
||||
#define CCARRAY_VERIFY_TYPE(__array__, __type__) void(0)
|
||||
|
|
Loading…
Reference in New Issue