From b3bef6655d8bbf51dc56eef5510992d201d15236 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 23 May 2016 21:13:30 +0300 Subject: [PATCH] Fixed issue #492. Valentina crashes when add an increment. --HG-- branch : release --- ChangeLog.txt | 1 + src/app/tape/tmainwindow.cpp | 3 +++ src/app/valentina/dialogs/dialogincrements.cpp | 3 +++ 3 files changed, 7 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index e4ee7affb..c11e25937 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ - [#473] Tape 'Preferences' cause loss of focus. - [#485] Error when drawing a curved path. - [#491] Valentina doesn't update fractional separator. +- [#492] Valentina crashes when add an increment. # Version 0.4.4 April 12, 2016 - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index bae6a000e..c02ec2b10 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -1004,6 +1004,9 @@ void TMainWindow::Fx() if (dialog->exec() == QDialog::Accepted) { + // Fix the bug #492. https://bitbucket.org/dismine/valentina/issues/492/valentina-crashes-when-add-an-increment + // Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer. + const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName); m->SetMValue(nameField->data(Qt::UserRole).toString(), dialog->GetFormula()); MeasurementsWasSaved(false); diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index cf974be30..f87b2006b 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -704,6 +704,9 @@ void DialogIncrements::Fx() if (dialog->exec() == QDialog::Accepted) { + // Fix the bug #492. https://bitbucket.org/dismine/valentina/issues/492/valentina-crashes-when-add-an-increment + // Because of the bug need to take QTableWidgetItem twice time. Previous update "killed" the pointer. + const QTableWidgetItem *nameField = ui->tableWidgetIncrement->item(row, 0); doc->SetIncrementFormula(nameField->text(), dialog->GetFormula()); FullUpdateTree(Document::LiteParse); ui->tableWidgetIncrement->selectRow(row);