From f9e0237e6798e167e672895d39525a750449932b Mon Sep 17 00:00:00 2001 From: Janne Kangas Date: Thu, 27 Sep 2018 10:28:42 +0300 Subject: Update datainput dialog internal map when renaming datainputs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dialog did not update the internal map when datainput name was changed. When the same datainput was edited again and map entry was queried with an incorrect name, dialog crashed. Change-Id: Ibe803cf20c0c42922d8622d21b33f885bfd82b2c Task-id: QT3DS-2406 Task-id: QT3DS-2405 Reviewed-by: Tomi Korpipää Reviewed-by: Miikka Heikkinen Reviewed-by: Antti Määttä --- src/Authoring/Studio/Application/DataInputListDlg.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Authoring/Studio/Application/DataInputListDlg.cpp b/src/Authoring/Studio/Application/DataInputListDlg.cpp index 238e3f3f..401ddee4 100644 --- a/src/Authoring/Studio/Application/DataInputListDlg.cpp +++ b/src/Authoring/Studio/Application/DataInputListDlg.cpp @@ -319,8 +319,16 @@ void CDataInputListDlg::onEditDataInput() CDataInputDlg datainputdialog(&di, m_tableContents, this, allowedTypes); datainputdialog.exec(); - // insert replaces the previous key - value pair + // if we are renaming a datainput, remove the old key - value and + // add it again as new entry with new name + if (m_currentDataInputName != di->name) { + m_dataInputs.remove(m_currentDataInputName); + m_currentDataInputName = di->name; + } + + // insert replaces the previous key - value pair if existing m_dataInputs.insert(m_currentDataInputName, di); + updateButtons(); updateContents(); -- cgit v1.2.3