Issue with "removeFromParentAndCleanup" called from inherited class chain.

I am curious if I am misunderstanding something here. I cant figure out why the setup below is bombing out and giving me memory access violations.

I have 2 classes (please forgive any syntax errors as this is only a code mockup).

class A : public CCSprite
{
public:
A();
void initSelf();
SCENE_NODE_FUNC(A);
};

A::A()
{

}

void A::initSelf()
{
CCSprite::initWithSpriteFrameName("a preloaded frame name");
}

//////////////////////////////////////////////////////////

class B : public A
{
public:
B();
void initSelf();
SCENE_NODE_FUNC(B);
};

B::B()
{

}

void B::initSelf()
{
this->A::initSelf();
}

//////////////////////////////////////////////////////////

/* Inside of a CCLayer */
B* someB = B::node();
someB->initSelf();
this->addChild(someB);

someB->removeFromParentAndCleanup(true); //Causes fault!
(OR)
this->removeChild(someB, true); //Wont fault, however the parent tells me that it does not contain this child

This is obviously not my entire code path, but I believe it is the portion that is faulting. If there is no reason for that to be happening, please let me know I and will continue to tear apart the rest of the class to determine if it is going awry somewhere else. However, I have a feeling this is happening because of the way SCENE_NODE_FUNC works? Is inheriting from a CCSprite, and then inheriting from that class, a bad practice, or am I missing something? Thanks in advance.

I don’t think the error caused by your pasted codes.
What’s the error, could you paste the error log?

Ok, so I am just an idiot :stuck_out_tongue: … As it turns out at some random part of the “tick” code I was calling a this->removeAllChildrenWithCleanup() for NO reason what so ever… Thus, it was clearing out all the pointers that I had been trying to keep, so when I called the removeWithCleanup it was obviously confused. My bad. Thanks for the help anyhow.