Cocos2dx 3.16: A big touching bug of Node and Widget, when it removed from parent

There is a bug:

First, I removed a Widget node from its parent and cleaned up.
Second, I added it to a parent as well as.
What a pity, it will be never responded touch again.

it’s so bad when using a TableView and so on.


I found the cause of it, due to a new code be added in Node::cleanup function:

_eventDispatcher->removeEventListenersForTarget(this);

And, after adding child, it doesn’t resume EventListener again.


Now, as a solution, I add some ugly code in Widget::onEnter.

    if (_touchEnabled) {
        setTouchEnabled(false);
        setTouchEnabled(true);
    }

Yes, I think it’s a same problem, you can have a try with my solution way, ugly but worked