mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
c8ec2f5b1c
commit
3b6b9951ae
2 changed files with 1 additions and 2 deletions
|
@ -547,7 +547,6 @@ void MainWindow::on_actionCloudstorageopen_triggered()
|
||||||
if (!parse_file(fileNamePtr.data(), &dive_table, &trip_table, &dive_site_table))
|
if (!parse_file(fileNamePtr.data(), &dive_table, &trip_table, &dive_site_table))
|
||||||
setCurrentFile(fileNamePtr.data());
|
setCurrentFile(fileNamePtr.data());
|
||||||
process_loaded_dives();
|
process_loaded_dives();
|
||||||
Command::clear();
|
|
||||||
hideProgressBar();
|
hideProgressBar();
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
}
|
}
|
||||||
|
@ -1695,7 +1694,6 @@ void MainWindow::loadFiles(const QStringList fileNames)
|
||||||
hideProgressBar();
|
hideProgressBar();
|
||||||
updateRecentFiles();
|
updateRecentFiles();
|
||||||
process_loaded_dives();
|
process_loaded_dives();
|
||||||
Command::clear();
|
|
||||||
|
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
|
|
||||||
|
|
|
@ -467,6 +467,7 @@ void DiveTripModelBase::initSelection()
|
||||||
|
|
||||||
void DiveTripModelBase::clear()
|
void DiveTripModelBase::clear()
|
||||||
{
|
{
|
||||||
|
Command::clear(); // If we clear the dive list, all undo-information becomes stalte.
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
clear_dive_file_data();
|
clear_dive_file_data();
|
||||||
clearData();
|
clearData();
|
||||||
|
|
Loading…
Add table
Reference in a new issue