A really small problem of CCMenu::init()

Today I’ve found a small problem of CCMenu class implementation, it is its ‘init’ method:

bool CCMenu::init()
{
va_list args;
return initWithItems(NULL, args);
}

Since I want to create several menu items dynamically, I just create a ‘CCMenu’ at first and call its init() method to do some init things, but unfortunately, it will cause a CRT check problem on some platform such as Win32 in Debug mode, the instruction says that we’ve used a un-inited ‘va_list’ …

So here, I think if we change it like below, maybe everything is OK :

bool CCMenu::init()
{
//va_list args;
return initWithItems(NULL, NULL/*args*/);
}

That’s all :slight_smile:

woudln’t it be easier to create your CCMenu by

CCMenu* temp=CCMenu::menuWithItem(NULL);

instead? That function handles the creation perfectly, I think.