Projects > cpp > Issues > Bug #2521

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

[JSB] CCBReader can't set properties to owner if 'owner var' is set

Bug #2521 [Closed]
dumganhar 2013-08-10 06:41 . Updated over 3 years ago

It’s caused by a logic error in CCNodeLoader.cpp —> NodeLoader::parsePropTypeCCBFile

Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader * pCCBReader) {

    if (reader->isJSControlled() && pCCBReader->isJSControlled() && NULL != reader->_owner)  // It should be 'NULL == reader->_owner' here.
    {
        //set variables and callback to owner
        //set callback
        Array *ownerCallbackNames = reader->getOwnerCallbackNames();
        Array *ownerCallbackNodes = reader->getOwnerCallbackNodes();
        if (NULL != ownerCallbackNames && ownerCallbackNames->count() > 0 &&
            NULL != ownerCallbackNodes && ownerCallbackNodes->count() > 0)
        {
            assert(ownerCallbackNames->count() == ownerCallbackNodes->count());
            int nCount = ownerCallbackNames->count();
            for (int i = 0 ; i < nCount; i++) {
                pCCBReader->addOwnerCallbackName((dynamic_cast(ownerCallbackNames->objectAtIndex(i)))->getCString());
                pCCBReader->addOwnerCallbackNode(dynamic_cast(ownerCallbackNames->objectAtIndex(i)) );
            }
        }
        //set variables
        Array *ownerOutletNames = reader->getOwnerOutletNames();
        Array *ownerOutletNodes = reader->getOwnerOutletNodes();
        if (NULL != ownerOutletNames && ownerOutletNames->count() > 0 &&
            NULL != ownerOutletNodes && ownerOutletNodes->count() > 0)
        {
            assert(ownerOutletNames->count() == ownerOutletNodes->count());
            int nCount = ownerOutletNames->count();
            for (int i = 0 ; i < nCount; i++) {
                pCCBReader->addOwnerOutletName((dynamic_cast(ownerOutletNames->objectAtIndex(i)))->getCString());
                pCCBReader->addOwnerOutletNode(dynamic_cast(ownerOutletNodes->objectAtIndex(i)) );
            }
        }
    }

    return ccbFileNode;
}
dumganhar 2013-08-10 14:50
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:671cc0aad53eb10f8c50a6fdab3e14951b0e4690.

Atom PDF

Status:Closed
Start date:2013-08-10
Priority:Normal
Due date:
Assignee:dumganhar
% Done:

100%

Category:js
Target version:3.0-alpha0

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.