Vector Iterator Error v3.7

In my projects I do not use a createScene method like in HelloWorld. Instead my HelloWord (and other scenes) are subclassing cocos2d::Scene. Doing this allows me to use the CREATE_FUNC() macro, and avoid making a createScene function.

HelloWorld.h
class HelloWorld : public cocos2d::Scene
{
public:
CREATE_FUNC(HelloWorld);
virtual bool init();
};

And in HelloWorld.cpp I have to call Scene::init (instead of Layer::init)
bool HelloWorld::init()
{
if ( !Scene::init() ){ return false; }

return true;

}

My first question, is there anything inherently wrong in creating scenes this way? I have been doing this for a while and haven’t had any problems until v3.7.

When I tried upgrading to v3.7 my game was crashing on startup with the failed assertion “vector iterators incompatible”. I found out what is causing the error, apparently having a std::vector member variable in my HelloWorld class is the problem. So just changing my HelloWorld.h to this:
class HelloWorld : public cocos2d::Scene
{
public:
CREATE_FUNC(HelloWorld);
virtual bool init();
std::vector myMemberVector;
};

Is enough to cause the assertion to fail (I don’t have to actually use the std::vector, just make it a member).

The assertion is being triggered by the first for loop in NavMesh::update(), and if I disable physics integration then I no longer get the error.

NOTE: this problem does not occur if using the default pattern of HelloWorld being a Layer and using a createScene method.

The error can easily be recreated in a new v3.7 project by making the changes I stated to HelloWorld.h and HelloWorld.cpp.

I am using Windows 7 and Visual Studio 2013 Update 4.

It’s not immediately obvious why a Scene is created using createScene(), rather than just using create(), however it does seem to be the established pattern, so I would recommend going back to using this pattern.

After reading this thread Layer Instantiates Scene? its clear that the createScene method is a carryover from previous versions, and I shouldn’t be getting the error I am.

I have created a github issue https://github.com/cocos2d/cocos2d-x/issues/12962

Personally I think the createScene pattern is confusing and should be removed.