summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/command_edit.cpp9
-rw-r--r--desktop-widgets/command_edit.h2
2 files changed, 7 insertions, 4 deletions
diff --git a/desktop-widgets/command_edit.cpp b/desktop-widgets/command_edit.cpp
index 5f6f0be3f..95665722d 100644
--- a/desktop-widgets/command_edit.cpp
+++ b/desktop-widgets/command_edit.cpp
@@ -687,7 +687,8 @@ static void swapCandQString(QString &q, char *&c)
}
PasteState::PasteState(dive *dIn, const dive *data, dive_components what) : d(dIn),
- tags(nullptr)
+ tags(nullptr),
+ cylinders(MAX_CYLINDERS)
{
memset(&cylinders[0], 0, sizeof(cylinders));
memset(&weightsystems, 0, sizeof(weightsystems));
@@ -742,8 +743,10 @@ void PasteState::swap(dive_components what)
std::swap(divesite, d->dive_site);
if (what.tags)
std::swap(tags, d->tag_list);
- if (what.cylinders)
- std::swap(cylinders, d->cylinder);
+ if (what.cylinders) {
+ for (int i = 0; i < MAX_CYLINDERS; ++i)
+ std::swap(cylinders[i], d->cylinder[i]);
+ }
if (what.weights)
std::swap(weightsystems, d->weightsystems);
}
diff --git a/desktop-widgets/command_edit.h b/desktop-widgets/command_edit.h
index ebce0bf1b..489c51046 100644
--- a/desktop-widgets/command_edit.h
+++ b/desktop-widgets/command_edit.h
@@ -246,7 +246,7 @@ struct PasteState {
int rating;
int visibility;
tag_entry *tags;
- cylinder_t cylinders[MAX_CYLINDERS];
+ std::vector<cylinder_t> cylinders;
struct weightsystem_table weightsystems;
PasteState(dive *d, const dive *data, dive_components what); // Read data from dive data for dive d