removeChild() problem


I defined a class _Class which inherit CCSprite.
I added some int variable to record some infomation.
But when I used removeChild(_Class,true),the memory crashed.

And the program ends at

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

    if (m_uReference == 0)
        delete this;

is there anybody can help me?


because the object is release twice.
remember one new is matched one release/autorelease/delete.

most objects should used like this: CCXXX *c1=CCXXX::create();
this code just like: CCXXX * c1=new CCXXX();c1->autorelease();

Some objects should be used in long life and it is not added to parent,code should like:
In Layer Class construct function: c1=new CCXXX();
In Layer Class deconstruct function: delete c1;

you must show me code that howto instance Class:
is it like this: ClassX * c=new ClassX();c->autorelease();