mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly copy weight systems on edit
We copied the string pointers instead of copying the strings. Once those got freed, things went downhill. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ac9c2ba544
commit
7196176fa0
1 changed files with 6 additions and 2 deletions
|
@ -781,12 +781,16 @@ void MainTab::acceptChanges()
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
MODIFY_SELECTED_DIVES(
|
MODIFY_SELECTED_DIVES(
|
||||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
|
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
|
||||||
if (mydive != cd && (copyPaste || same_string(mydive->weightsystem[i].description, cd->weightsystem[i].description)))
|
if (mydive != cd && (copyPaste || same_string(mydive->weightsystem[i].description, cd->weightsystem[i].description))) {
|
||||||
mydive->weightsystem[i] = displayed_dive.weightsystem[i];
|
mydive->weightsystem[i] = displayed_dive.weightsystem[i];
|
||||||
|
mydive->weightsystem[i].description = copy_string(displayed_dive.weightsystem[i].description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
|
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
|
||||||
cd->weightsystem[i] = displayed_dive.weightsystem[i];
|
cd->weightsystem[i] = displayed_dive.weightsystem[i];
|
||||||
|
cd->weightsystem[i].description = copy_string(displayed_dive.weightsystem[i].description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// each dive that was selected might have had the temperatures in its active divecomputer changed
|
// each dive that was selected might have had the temperatures in its active divecomputer changed
|
||||||
// so re-populate the temperatures - easiest way to do this is by calling fixup_dive
|
// so re-populate the temperatures - easiest way to do this is by calling fixup_dive
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue