aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/command_divelist.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp
index 995a0ec15..c49159f5a 100644
--- a/desktop-widgets/command_divelist.cpp
+++ b/desktop-widgets/command_divelist.cpp
@@ -727,12 +727,20 @@ SplitDivesBase::SplitDivesBase(dive *d, std::array<dive *, 2> newDives)
newDives[0]->selected = false;
newDives[1]->selected = false;
+ // The new dives will be registered to the dive site using the site member
+ // of the DiveToAdd structure. For this to work, we must set the dive's
+ // dive_site member to null. Yes, that's subtle!
+ newDives[0]->dive_site = nullptr;
+ newDives[1]->dive_site = nullptr;
+
diveToSplit.dives.push_back(d);
splitDives.dives.resize(2);
splitDives.dives[0].dive.reset(newDives[0]);
splitDives.dives[0].trip = d->divetrip;
+ splitDives.dives[0].site = d->dive_site;
splitDives.dives[1].dive.reset(newDives[1]);
splitDives.dives[1].trip = d->divetrip;
+ splitDives.dives[1].site = d->dive_site;
}
bool SplitDivesBase::workToBeDone()
@@ -875,6 +883,7 @@ MergeDives::MergeDives(const QVector <dive *> &dives)
mergedDive.dives.resize(1);
mergedDive.dives[0].dive = std::move(d);
mergedDive.dives[0].trip = preferred_trip;
+ mergedDive.dives[0].site = preferred_site;
divesToMerge.dives = dives.toStdVector();
}