Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCNotificationCenter is unable to post notifications for cocos2x-2.1.0-wp8-alpha-2.0 #26

Open
saudahmed opened this issue Apr 7, 2013 · 2 comments

Comments

@saudahmed
Copy link

When you postnotification by using the method below

void CCNotificationCenter::postNotification(const char name, CCObject *object)
{
CCObject
obj = NULL;
CCARRAY_FOREACH(m_observers, obj)
{
CCNotificationObserver* observer = (CCNotificationObserver*) obj;
if (!observer)
continue;

    CCLOG("observerName: %s", observer->getName());

    if (!strcmp(name,observer->getName()))
        observer->performSelector(object);
}

}

observer->getName() always gives an empty string. When I went through the constructor of CCNotificationObserver in m_name it places a garbage value and I believe this bug was reported and one forgot to fix it

CCNotificationObserver::CCNotificationObserver(CCObject *target,
SEL_CallFuncO selector,
const char *name,
CCObject *obj)
{
m_target = target;
m_selector = selector;
m_object = obj;

m_name = new char[strlen(name)+1];
memset(m_name,0,strlen(name)+1);

string orig (name);

//bug fix me orig.copy(m_name,strlen(name),0);
}

@dumganhar
Copy link

@QiMa
I also want to know why they comment that line.

@QiMa
Copy link

QiMa commented Apr 8, 2013

I see. I will fix it these days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants