Fixed issue #492. Valentina crashes when add an increment.

(grafted from 5d4057b6c1b14fbc6f8ff2be39c2066a14412d4e)

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-05-23 21:16:43 +03:00
parent b820d5a6ea
commit 823b29d907
3 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,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.

View File

@ -1012,6 +1012,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);

View File

@ -681,6 +681,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);