add missing safe guard in checkbox callback

This commit is contained in:
andyque 2014-08-13 17:15:15 +08:00
parent 8fdaaccd3d
commit 3ee6a9ab10
1 changed files with 4 additions and 0 deletions

View File

@ -356,6 +356,7 @@ bool CheckBox::getSelectedState()const
void CheckBox::selectedEvent()
{
this->retain();
if (_checkBoxEventCallback)
{
_checkBoxEventCallback(this, EventType::SELECTED);
@ -365,10 +366,12 @@ void CheckBox::selectedEvent()
{
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_SELECTED);
}
this->release();
}
void CheckBox::unSelectedEvent()
{
this->retain();
if (_checkBoxEventCallback) {
_checkBoxEventCallback(this, EventType::UNSELECTED);
}
@ -376,6 +379,7 @@ void CheckBox::unSelectedEvent()
{
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_UNSELECTED);
}
this->release();
}
void CheckBox::addEventListenerCheckBox(Ref *target, SEL_SelectedStateEvent selector)