Bad memory access fix.

This commit is contained in:
Martín Lucas Golini
2020-07-01 18:50:49 -03:00
parent b916517fd1
commit 0abd5bb6d7
2 changed files with 21 additions and 17 deletions

View File

@@ -87,11 +87,13 @@ void UIMenuCheckBox::setActive( const bool& active ) {
}
if ( oActive != active ) {
UIMenu* Menu = getParent()->asType<UIMenu>();
if ( getParent()->isType( UI_TYPE_MENU ) ) {
UIMenu* menu = getParent()->asType<UIMenu>();
if ( !Menu->widgetCheckSize( this ) ) {
if ( NULL != getIcon()->getDrawable() ) {
setPadding( Rectf( 0, 0, 0, 0 ) );
if ( !menu->widgetCheckSize( this ) ) {
if ( NULL != getIcon()->getDrawable() ) {
setPadding( Rectf( 0, 0, 0, 0 ) );
}
}
}

View File

@@ -92,21 +92,23 @@ void UIMenuRadioButton::setActive( const bool& active ) {
}
}
UIMenu* Menu = getParent()->asType<UIMenu>();
if ( getParent()->isType( UI_TYPE_MENU ) ) {
UIMenu* menu = getParent()->asType<UIMenu>();
if ( !Menu->widgetCheckSize( this ) ) {
if ( NULL != getIcon()->getDrawable() ) {
setPadding( Rectf( 0, 0, 0, 0 ) );
}
}
if ( mActive ) {
Node* child = Menu->getFirstChild();
while ( child ) {
if ( child->isType( UI_TYPE_MENURADIOBUTTON ) && child != this ) {
child->asType<UIMenuRadioButton>()->setActive( false );
if ( !menu->widgetCheckSize( this ) ) {
if ( NULL != getIcon()->getDrawable() ) {
setPadding( Rectf( 0, 0, 0, 0 ) );
}
}
if ( mActive ) {
Node* child = menu->getFirstChild();
while ( child ) {
if ( child->isType( UI_TYPE_MENURADIOBUTTON ) && child != this ) {
child->asType<UIMenuRadioButton>()->setActive( false );
}
child = child->getNextNode();
}
child = child->getNextNode();
}
}