mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15999 from ricardoquesada/issue13351
fix: not leak Toggle items
This commit is contained in:
commit
935c60c552
|
@ -789,6 +789,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s
|
|||
{
|
||||
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
|
||||
ret->MenuItem::initWithCallback(std::bind(selector, target, std::placeholders::_1));
|
||||
ret->autorelease();
|
||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||
if (sEngine)
|
||||
|
@ -812,6 +813,7 @@ MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callba
|
|||
{
|
||||
MenuItemToggle *ret = new (std::nothrow) MenuItemToggle();
|
||||
ret->MenuItem::initWithCallback(callback);
|
||||
ret->autorelease();
|
||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||
if (sEngine)
|
||||
|
|
Loading…
Reference in New Issue