Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector iterator not incrementable #151

Open
wbbtcool opened this issue Apr 25, 2017 · 1 comment
Open

vector iterator not incrementable #151

wbbtcool opened this issue Apr 25, 2017 · 1 comment

Comments

@wbbtcool
Copy link

wbbtcool commented Apr 25, 2017

cocos2x : 3.14.1
platform:win32
IDE: vs2015

My English is not very good. In win32 , i have encountered a problem in which the animation can not be played. But iOS and Android will not happen.

Debug Assertion Failed!

Program: C:\Windows\SYSTEM32\MSVCP140D.dll
File: f:\microsoft visual studio 14.0\vc\include\vector
Line: 101

Expression: vector iterator not incrementable

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)

I modified the official demo.
my code:

        _armatureDisplay = _factory.buildArmatureDisplay("DragonBoy");
        
        const auto center = cocos2d::Director::getInstance()->getVisibleSize();
        _armatureDisplay->setPosition(center.width * 0.5f, center.height * 0.5f);
        _armatureDisplay->setScale(_armatureScale);
        this->addChild(_armatureDisplay);
       
        _armatureDisplay->getAnimation().play("stand");
        
        _armatureDisplay->getEventDispatcher()->setEnabled(true);
        _armatureDisplay->getEventDispatcher()->addCustomEventListener(EventObject::COMPLETE, [=] (EventCustom *event) {
            const auto eventObject = (dragonBones::EventObject*)event->getUserData();
			eventObject->armature->getAnimation().play("walk");
           
        });

The program will stop here.
Armature.h

        if (!_events.empty())
        {
            for (const auto event : _events)    //debug stop here
            {
                if (EventObject::_soundEventManager && event->type == EventObject::SOUND_EVENT)
                {
                    EventObject::_soundEventManager->_dispatchEvent(event);
                }
                else
                {
                    _display->_dispatchEvent(event);
                }

                event->returnToPool();
            }

            _events.clear();
        }

I don't know why it happened .
Help. Thanks!

@wbbtcool
Copy link
Author

......I found.
for (const auto event : _events)
modify:

for (unsigned int i = 0; i < _events.size(); i++)
{
      EventObject* event = _events[i];
      ......
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant