diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-11-15 20:16:02 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-11-16 08:29:53 -0800 |
commit | 12c7c5ea961bcdc866dbf6ce121c428d43c3730b (patch) | |
tree | da2c5a001b75464af814151b3c6534e4633921d8 | |
parent | 808316f4342dff72fd79cfadf3cc01e41237c65e (diff) | |
download | subsurface-12c7c5ea961bcdc866dbf6ce121c428d43c3730b.tar.gz |
Cleanup: move clearing of current_dive into clear_dive_file_data()
It makes no sense to have a non-NULL current_dive once all dives
have been deleted. Therefore, clear current_dive implicitly in
clear_dive_file_data() and don't depend on the caller performing
this.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | core/divelist.c | 1 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 1 |
2 files changed, 1 insertions, 1 deletions
diff --git a/core/divelist.c b/core/divelist.c index 451ed70a7..a9ce0d7a3 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -1446,6 +1446,7 @@ void clear_dive_file_data() { while (dive_table.nr) delete_single_dive(0); + current_dive = NULL; while (dive_site_table.nr) delete_dive_site(get_dive_site(0, &dive_site_table), &dive_site_table); if (trip_table.nr != 0) { diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 416119b3b..632917733 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -658,7 +658,6 @@ void MainWindow::closeCurrentFile() /* free the dives and trips */ clear_git_id(); clear_dive_file_data(); - current_dive = nullptr; setCurrentFile(nullptr); graphics->setEmptyState(); mainTab->clearTabs(); |