QmlDesigner: Fix potential crash

It is not crashing with 5.12.3 and 5.13.0

Task-number: QDS-916
Change-Id: I87bd83b90b1eb74c7825564ea789def52eaa8df0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Tim Jenssen
2019-08-14 17:35:02 +02:00
committed by Thomas Hartmann
parent ab9aae4856
commit 85cb981486

View File

@@ -37,6 +37,8 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagebox.h> #include <coreplugin/messagebox.h>
#include <QWidget>
enum { enum {
debug = false debug = false
}; };
@@ -181,10 +183,11 @@ void StatesEditorModel::renameState(int internalNodeId, const QString &newName)
return; return;
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) { if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
Core::AsynchronousMessageBox::warning(tr("Invalid state name"), auto w = Core::AsynchronousMessageBox::warning(tr("Invalid state name"),
newName.isEmpty() ? newName.isEmpty() ?
tr("The empty string as a name is reserved for the base state.") : tr("The empty string as a name is reserved for the base state.") :
tr("Name already used in another state")); tr("Name already used in another state"));
w->setAttribute(Qt::WA_ShowModal, false);
reset(); reset();
} else { } else {
m_statesEditorView->renameState(internalNodeId, newName); m_statesEditorView->renameState(internalNodeId, newName);