继承CCSprite类,初始化就报错

最近用pop cap的宝石迷阵资源练练手。不想遇到个问题,本人才疏学浅,实在不知道咋解决,求大伙帮忙看看。
写宝石类,继承CCSprite,如下

class CCBlock : public cocos2d::CCSprite
{
public:
	JewelType type;
	int moveStep;
	bool bWillRemove;
	void removeSelf()
	{
		this->removeFromParentAndCleanup(true);
	}

public:
	JewelType getType() 
	{
		return type;
	}
	void setType(int value) 
	{
		this->type = (JewelType)value;
	}
	bool getWillRemove()
	{
		return bWillRemove;
	}
	void setWillRemove(bool b) 
	{
		bWillRemove = b;
	}
	int getMoveStep() 
	{
		return moveStep;
	}
	void setMoveStep(int step) 
	{
		moveStep = step;
	}
};

然后在游戏层中初始化它:

void GameLayer::initBlocks()
{
	srand(time(NULL));
	for(int i=0; i<BLOCKHEIGHT; i++)
		for(int j=0; j<BLOCKWIDTH; j++)
		{
			int type = rand()%7 + 1;
			CCBlock* block = (CCBlock*)CCBlock::createWithSpriteFrameName(CCString::createWithFormat("Jewel%d.png", type)->getCString());
			block->retain();
 			block->setPosition(ccp(313 + 60*j, 104 + 60*i));
 			block->setType(type);
			block->setWillRemove(false);        <<========这里出问题了

这里就出现问题了。
如果在调试模式下(F5运行),程序可以正常运行。
但是如果直接(CTRL+F5)的话,就“停止运行”,调试的话说的“堆已损坏”,但偶然也能运行。
把debug或者release文件夹加上资源文件拷出去的话,运行一定是“停止运行”。

把上面的“block->setWillRemove(false)” 和 “block->setMoveStep(0)”去掉的话能运行。
block->setType(type)这句 却对程序没什么影响,诡异啊。

整了2、3天,也没找到什么原因。
求大神指点一下。感激不尽!

1238

1239

1240

1241

版本用的2.1.4 和2.1.4f均有这个问题。

继续求大神。。。{:soso_e183:}{:soso_e183:}

你继承CCSprite的子类根本没实例化,子类没有new怎么可能实例化(开辟内存空间呢) 你后面使用一个没有开辟内存空间的对象怎么可能没错呢