遇到了一个崩溃问题,求思路(版本2.2.2)

报错信息如下:

Incident Identifier: 1E6EE844-9B8B-42AD-9046-635D1839AC65
CrashReporter Key: 9f9ba3dfd9be00ec3d5b322e2e879df3088476c1
Hardware Model: iPhone5,2
Process: ChinaTaxi2
Path: /var/mobile/Applications/ACDFC994-D698-43F1-A9E8-41620609CFA1/ChinaTaxi2.app/ChinaTaxi2
Identifier: com.keyloft.ctx
Version: 1.0
Code Type: ARM (Native)
Parent Process: launchd

Date/Time: 2014-08-28 16:31:48.676 +0800
OS Version: iOS 7.1.1 (11D201)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x4718e30c
Triggered by Thread: 0

Thread 0 Crashed:
0 ChinaTaxi2 0x0030683e cocos2d::CCObject::release() (CCObject.cpp:81)
1 ChinaTaxi2 0x00302666 cocos2d::CCDictionary::removeObjectForElememt(cocos2d::CCDictElement*) (CCDictionary.cpp:319)
2 ChinaTaxi2 0x00303cde cocos2d::CCDictionary::removeObjectForKey(std::string const&) (CCDictionary.cpp:274)
3 ChinaTaxi2 0x003042f8 cocos2d::CCDictionary::removeObjectsForKeys(cocos2d::CCArray*) (CCDictionary.cpp:310)
4 ChinaTaxi2 0x003473cc cocos2d::CCSpriteFrameCache::removeSpriteFramesFromDictionary(cocos2d::CCDictionary*) (CCSpriteFrameCache.cpp:375)
5 ChinaTaxi2 0x00347042 cocos2d::CCSpriteFrameCache::removeSpriteFramesFromFile(char const*) (CCSpriteFrameCache.cpp:349)
6 ChinaTaxi2 0x001481aa PlayScene::releaseTexture() (PlayScene.cpp:366)
7 ChinaTaxi2 0x00147fd0 PlayScene::onExit() (PlayScene.cpp:318)
8 ChinaTaxi2 0x002efd62 cocos2d::CCNode::detachChild(cocos2d::CCNode*, bool) (CCNode.cpp:739)
9 ChinaTaxi2 0x002efd26 cocos2d::CCNode::removeChild(cocos2d::CCNode*, bool) (CCNode.cpp:667)
10 ChinaTaxi2 0x002efca8 cocos2d::CCNode::removeFromParentAndCleanup(bool) (CCNode.cpp:644)
11 ChinaTaxi2 0x00149d8e PlayScene::releaseToReStart() (PlayScene.cpp:1215)
12 ChinaTaxi2 0x001ae9d4 GameSuccessLayer::onClickContinue() (GameSuccessLayer.cpp:935)
13 ChinaTaxi2 0x002497ee MButtionNode::onClick() (MButtionNode.cpp:129)
14 ChinaTaxi2 0x00249766 MButtionNode::endTouch(cocos2d::CCTouch*) (MButtionNode.cpp:119)
15 ChinaTaxi2 0x001b064c GameSuccessLayer::ccTouchEnded(cocos2d::CCTouch*, cocos2d::CCEvent*) (GameSuccessLayer.cpp:900)
16 ChinaTaxi2 0x001b0670 non-virtual thunk to GameSuccessLayer::ccTouchEnded(cocos2d::CCTouch*, cocos2d::CCEvent*) (GameSuccessLayer.cpp:901)
17 ChinaTaxi2 0x0035ab5c cocos2d::CCTouchDispatcher::touches(cocos2d::CCSet*, cocos2d::CCEvent*, unsigned int) (CCTouchDispatcher.cpp:377)
18 ChinaTaxi2 0x0035af7e cocos2d::CCTouchDispatcher::touchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*) (CCTouchDispatcher.cpp:507)
19 ChinaTaxi2 0x0035afa4 non-virtual thunk to cocos2d::CCTouchDispatcher::touchesEnded(cocos2d::CCSet*, cocos2d::CCEvent*) (CCTouchDispatcher.cpp:509)
20 ChinaTaxi2 0x0032a594 cocos2d::CCEGLViewProtocol::handleTouchesEnd(int, int*, float*, float*) (CCEGLViewProtocol.cpp:334)
21 ChinaTaxi2 0x00335be0 - (EAGLView.mm:454)
22 UIKit 0x2ff91d48 - + 524
23 UIKit 0x2ff8cca2 - + 754
24 UIKit 0x2ff61e70 - + 192
25 UIKit 0x2ff6053c _UIApplicationHandleEventQueue + 7116
26 CoreFoundation 0x2d6f8fec CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 12
27 CoreFoundation 0x2d6f84b2 __CFRunLoopDoSources0 + 202
28 CoreFoundation 0x2d6f6ca2 __CFRunLoopRun + 626
29 CoreFoundation 0x2d661764 CFRunLoopRunSpecific + 520
30 CoreFoundation 0x2d661546 CFRunLoopRunInMode + 102
31 GraphicsServices 0x325ce6ce GSEventRunModal + 134
32 UIKit 0x2ffc088c UIApplicationMain + 1132
33 ChinaTaxi2 0x001c383e main (main.m:9)
34 ChinaTaxi2 0x000e97b4 start + 36

根据提示查看跟到了这里

void CCDictionary::removeObjectForElememt(CCDictElement* pElement)
{
    if (pElement != NULL)
    {
        HASH_DEL(m_pElements, pElement);
        pElement->m_pObject->release();
        CC_SAFE_DELETE(pElement);
    }
}


```


void CCObject::release(void)
{
    CCAssert(m_uReference > 0, "reference count should greater than 0");
    --m_uReference;

    if (m_uReference == 0)
    {
        delete this;
    }
}

```


说是 pElement->m_pObject->release();释放的时候引用计数已经不合法了~ 只是释放了纹理而已,求大家给一个可能照成这个崩溃的思路。

崩溃不是必现~ 只是偶尔出现

4 ChinaTaxi2 0x003473cc cocos2d::CCSpriteFrameCache::removeSpriteFramesFromDictionary(cocos2d::CCDictionary*) (CCSpriteFrameCache.cpp:375)
5 ChinaTaxi2 0x00347042 cocos2d::CCSpriteFrameCache::removeSpriteFramesFromFile(char const*) (CCSpriteFrameCache.cpp:349)
从这里看应该是释放spriteFrame时候出错了,检查一下你的plist文件里是否有重名的图片,如果有可能引起问题

EXC_BAD_ACCESS (SIGSEGV)
这个类型的Exception的意思是,你没有权限访问你所要访问的内存。
一般都是由于访问了已经被release的object导致的,或者把一个object release了两次(我的理解这和前面的情况是一样的)。
甚至当你访问超出数组长度的内容时,也有可能出现这种类型的错误(你的问题应该不是这个,而是前者)。
看哪些涉及release的 LOG出计数好好查查吧

多谢,我查询一下是否有重名的情况~

最后这个问题是怎么解决的

object删除问题,查看下是否重复删除!是否使用数组保存了object指针,你删除了object,但没清除保存在数组中的指针,导致你再次遍历数组时又删除了一遍