Avoid a crash in general text field dialog.

onEnterPressed can be executed twice - in event handler and in input manager.
This commit is contained in:
Deve 2018-04-15 21:14:24 +02:00
parent 32acae7507
commit 868dbf792c

View File

@ -69,7 +69,7 @@ GUIEngine::EventPropagation GeneralTextFieldDialog::processEvent(const std::stri
else if (eventSource == "ok")
{
// If validation callback return true, dismiss the dialog
if (m_val_cb(m_title, m_text_field))
if (!m_self_destroy && m_val_cb(m_title, m_text_field))
m_self_destroy = true;
return GUIEngine::EVENT_BLOCK;
}
@ -88,7 +88,7 @@ void GeneralTextFieldDialog::onEnterPressedInternal()
return;
}
if (m_val_cb(m_title, m_text_field))
if (!m_self_destroy && m_val_cb(m_title, m_text_field))
m_self_destroy = true;
} // onEnterPressedInternal