From 4029c87ec765dc49ccf2ed97dec1210d70da8014 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 9 Dec 2014 21:15:52 -0700 Subject: Hide any pictures shown when closing divelog Fixes #776 Signed-off-by: Dirk Hohndel --- qt-ui/divepicturewidget.cpp | 3 ++- qt-ui/mainwindow.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'qt-ui') diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp index 03c0321d4..d42afefbf 100644 --- a/qt-ui/divepicturewidget.cpp +++ b/qt-ui/divepicturewidget.cpp @@ -44,7 +44,8 @@ void DivePictureModel::updateDivePictures() endRemoveRows(); } - numberOfPictures = dive_get_picture_count(&displayed_dive); + // if the dive_table is empty, ignore the displayed_dive + numberOfPictures = dive_table.nr == 0 ? 0 : dive_get_picture_count(&displayed_dive); if (numberOfPictures == 0) { return; } diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 901a039f3..acf520dd6 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -289,6 +289,8 @@ void MainWindow::on_actionClose_triggered() { if (okToClose(tr("Please save or cancel the current dive edit before closing the file."))) { closeCurrentFile(); + // hide any pictures and the filter + DivePictureModel::instance()->updateDivePictures(); ui.multiFilter->closeFilter(); recreateDiveList(); } -- cgit v1.2.3-70-g09d2