V3.15.1 button stops working after removeChild and addChild

hi all,
i just checked out the newest cocos version (3.15.1),
created a new project on my mac via

cocos new MyGame -p com.MyCompany.MyGame -l cpp -d ./MyCompany

and changed this line in HelloWorldScene.cpp:

this->addChild(menu, 1);

to this

this->addChild(menu, 1);
this->removeChild(menu);
this->addChild(menu,1);

and hit the run button for the macos target.

the button is still visible as expected, but does not respond to clicks.
if i do the same thing with v3.15, the button works normal.
i think something bad happend between v3.15 and v3.15.1

best

I will have a try.

@badmonkee you used github latest codes, the version is not updated since release, so may be i should change the version to “v3.15-next”. So the issue is not imported in v3.15.1, it is caused by this PR. event listener will be remove when it is cleaned up as actions.

Node::removeChild() will clean up child by default, so you should invoke Node::removeChild(child, false) here:

this->addChild(menu, 1);
this->removeChild(menu, false);
this->addChild(menu,1);

ok, thanks!