diff options
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r-- | desktop-widgets/divelistview.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp index 945a7381e..938a4e3e5 100644 --- a/desktop-widgets/divelistview.cpp +++ b/desktop-widgets/divelistview.cpp @@ -633,12 +633,16 @@ void DiveListView::splitDives() int i; struct dive *dive; + // Let's collect the dives to be split first, so that we don't catch newly inserted dives! + QVector<struct dive *> dives; for_each_dive (i, dive) { if (dive->selected) - split_dive(dive); + dives.append(dive); + } + for (struct dive *d: dives) { + UndoSplitDives *undoCommand = new UndoSplitDives(d, duration_t{-1}); + MainWindow::instance()->undoStack->push(undoCommand); } - MainWindow::instance()->refreshProfile(); - MainWindow::instance()->refreshDisplay(); } void DiveListView::renumberDives() |