From dd6eb522f81346c839a3336ec6153abbb4214818 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 29 Oct 2014 10:26:12 +0200 Subject: [PATCH] Program is crashing if open dialog history and change current pattern piece. --HG-- branch : develop --- src/app/dialogs/app/dialoghistory.cpp | 3 +-- src/app/mainwindow.cpp | 2 ++ src/app/mainwindow.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/dialogs/app/dialoghistory.cpp b/src/app/dialogs/app/dialoghistory.cpp index 983be07fd..39e0a34b6 100644 --- a/src/app/dialogs/app/dialoghistory.cpp +++ b/src/app/dialogs/app/dialoghistory.cpp @@ -57,7 +57,6 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent) connect(this, &DialogHistory::ShowHistoryTool, doc, &VPattern::ShowHistoryTool); connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory); - connect(doc, &VPattern::ChangedActivPP, this, &DialogHistory::UpdateHistory); ShowPoint(); } @@ -183,7 +182,7 @@ void DialogHistory::FillTable() } } ui->tableWidget->setRowCount(count);//Real row count - if (history->size()>0) + if (count>0) { cursorRow = currentRow; QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 367579fd6..01a7dbe01 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1744,6 +1744,7 @@ void MainWindow::ActionHistory(bool checked) { dialogHistory = new DialogHistory(pattern, doc, this); dialogHistory->setWindowFlags(Qt::Window); + connect(this, &MainWindow::RefreshHistory, dialogHistory, &DialogHistory::UpdateHistory); connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory); dialogHistory->show(); } @@ -2392,6 +2393,7 @@ void MainWindow::ChangePP(int index, bool zoomBestFit) { doc->ChangeActivPP(comboBoxDraws->itemText(index)); doc->setCurrentData(); + emit RefreshHistory(); if (drawMode) { ArrowTool(); diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index 3777cc4f3..9f32d8e34 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -133,6 +133,7 @@ signals: * @param description pattern description. */ void ModelChosen(QVector listDetails, const QString &curFile, const QString &description); + void RefreshHistory(); protected: virtual void keyPressEvent(QKeyEvent *event); virtual void showEvent(QShowEvent *event);