B
B
BonBon Slick2020-01-17 15:59:25
C++ / C#
BonBon Slick, 2020-01-17 15:59:25

0xDDDDDDDD validation?

pointDrawNode = DrawNode::create();

ssize_t Node::getNumberOfRunningActions() const
{
    return _actionManager->getNumberOfRunningActionsInTarget(this);
}
Exception thrown: read access violation.
this->_actionManager was 0xDDDDDDDD.

void PlayScene::update(float timeBetweenFrames)
{
  if (pointDrawNode != nullptr && NULL != pointDrawNode && 0 == pointDrawNode->getNumberOfRunningActions()) {
    schedule(CC_SCHEDULE_SELECTOR(PlayScene::removePoint), 1);
  }
}

removeChildByTag(tagNames::point);
void Node::detachChild(Node *child, ssize_t childIndex, bool doCleanup)
{.....

After the first removal of the node from the layout and its re-creation, pointDrawNode points to nullptr for some time
.
The check is performed every frame, so in some frames the Node has not yet been created or has been deleted, and we fall into the gap before the new one will be created.
How to avoid this error?
What check should be done?
Or can the data be changed?
Expose immediately new after deletion?
What is more correct?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question