undo: clear undo-stack when clearing dive data

When the dive data is cleared, all pointers in the undo-stack become stale.
Desktop explicitly called Command::clear() in that case, but mobile doesn't.
Thus, move the clear() call into DiveTripModelBase::clear()

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-11-16 22:00:25 +01:00 committed by Dirk Hohndel
parent c8ec2f5b1c
commit 3b6b9951ae
2 changed files with 1 additions and 2 deletions

View file

@ -547,7 +547,6 @@ void MainWindow::on_actionCloudstorageopen_triggered()
if (!parse_file(fileNamePtr.data(), &dive_table, &trip_table, &dive_site_table))
setCurrentFile(fileNamePtr.data());
process_loaded_dives();
Command::clear();
hideProgressBar();
refreshDisplay();
}
@ -1695,7 +1694,6 @@ void MainWindow::loadFiles(const QStringList fileNames)
hideProgressBar();
updateRecentFiles();
process_loaded_dives();
Command::clear();
refreshDisplay();

View file

@ -467,6 +467,7 @@ void DiveTripModelBase::initSelection()
void DiveTripModelBase::clear()
{
Command::clear(); // If we clear the dive list, all undo-information becomes stalte.
beginResetModel();
clear_dive_file_data();
clearData();