Projects > cpp > Issues > Bug #3106

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

EventListeners can't be removed sometimes

Bug #3106 [Closed]
dumganhar 2013-11-02 14:04 . Updated about 3 years ago

Need adding new test for this issue.

    auto item3 = MenuItemFont::create("Click Me 3", [=](Object* sender){
        auto listener = EventListenerTouchOneByOne::create();
        listener->onTouchBegan = [](Touch* touch, Event* event) -> bool{
            CCASSERT(false, "Should not come here!");  // This callback should not be invoked, since the listener was removed after it was added.
            return true;
        };

        _eventDispatcher->addEventListenerWithFixedPriority(listener, -1);
        _eventDispatcher->removeEventListener(listener);

        addNextButton();
    });
dumganhar 2013-11-02 14:13
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:0171bb55a20316dbdbdc36ac01dc68bc4928ac43.

Atom PDF

Status:Closed
Start date:2013-11-02
Priority:Normal
Due date:
Assignee:dumganhar
% Done:

100%

Category:all
Target version:3.0-alpha1

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.