Mercurial > octave
changeset 25544:15460ae5462d
fix crash when closing uiwidget_creator dialog by x-button or Alt+F4 (bug #54231)
* dialog.cc (QUIWidgetCreator::dialog_button_clicked): test the given button if it
it null, which is the case when the dialog was closed
author | Torsten <mttl@mailbox.org> |
---|---|
date | Mon, 02 Jul 2018 22:27:00 +0200 |
parents | 115db34f35fb |
children | 93b564c789aa |
files | libgui/src/dialog.cc |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/dialog.cc Mon Jul 02 12:32:24 2018 -0700 +++ b/libgui/src/dialog.cc Mon Jul 02 22:27:00 2018 +0200 @@ -70,15 +70,18 @@ // Wait for link thread to go to sleep state. lock (); - // Check for a matching button text while ignoring accelerators because - // the window manager may have added one in the passed button - QString text_clean = rm_amp (button->text ()); - for (int i = 0; i < m_button_list.count (); i++) + if (button) // button is NULL when dialog is closed { - if (rm_amp (m_button_list.at (i)) == text_clean) + // Check for a matching button text while ignoring accelerators because + // the window manager may have added one in the passed button + QString text_clean = rm_amp (button->text ()); + for (int i = 0; i < m_button_list.count (); i++) { - m_dialog_button = m_button_list.at (i); // text w/o extra accelerator - break; + if (rm_amp (m_button_list.at (i)) == text_clean) + { + m_dialog_button = m_button_list.at (i); // text w/o extra accelerator + break; + } } }