Solve a possible memory leak in HttpRequest

This commit is contained in:
pandamicro 2015-11-25 14:03:56 +08:00
parent 930405d52c
commit 23f27534f6
1 changed files with 6 additions and 2 deletions

View File

@ -252,7 +252,7 @@ public:
* @param pTarget the target object pointer.
* @param pSelector the SEL_HttpResponse function.
*/
CC_DEPRECATED_ATTRIBUTE inline void setResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
inline void setResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
{
doSetResponseCallback(pTarget, pSelector);
}
@ -339,9 +339,13 @@ public:
private:
inline void doSetResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
{
if (_pTarget)
{
_pTarget->release();
}
_pTarget = pTarget;
_pSelector = pSelector;
if (_pTarget)
{
_pTarget->retain();