mirror of https://github.com/axmolengine/axmol.git
add missing safe guard in checkbox callback
This commit is contained in:
parent
8fdaaccd3d
commit
3ee6a9ab10
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue