The game recharge interface is always intermittent, and the debug debugging breakpoint is always broken in a deep position, and there is no error.
Later, a breakpoint was broken at the place where the program created a prompt image, so I checked the code and found the problem.
The error code before modification:
1. Create the code for the prompt:
M_loading = new netloading (this, callfunc_selector (iapshoplayer: downingupdate); // m_loading reference count is 1
M_loading-> setposition (CCP (1139/2. 0f, 640366f/2.0f ));
M_loading-> autorelease (); // m_loading is added to the automatic management pool.
Addchild (m_loading, 1000 );
2. Remove the prompt code
If (m_loading! = NULL)
{
If (m_loading-> getparent ()! = NULL)
{
Removechild (m_loading, true); // m_loading reference count minus one, 0, releases this object
}
M_loading-> release (); // The m_loading object does not exist and an error is returned.
M_loading = NULL;
}
Error cause:
M_loading-> autorelease ();
The object has adopted an automatic management mechanism, so you do not need to manually call release () to reduce the reference count by 1.
Removechild (m_loading, true); after the code is executed, the automatic management mechanism determines that the object is no longer in use. Therefore, the m_loading reference count is reduced by one. At this time, the reference count of m_loading is 0 and released.
Therefore, an error is returned when m_loading-> release () is executed.
Summary: in the future, the object memory management will always be careful. The memory management solution either uses manual management or automatic management, but cannot be used at the same time. (Which memory management method is used depends on the actual situation)
Cocos2dx memory management mechanism reference: http://blog.csdn.net/ring0hx/article/details/7946397
refresh bug fixing summary on the refresh interface of the anti-DDoS Pro 2 (cocos2dx Memory Management Mechanism)