Edition of cylinders broken
Patrick Valsecchi
patrick at thus.ch
Tue Jan 7 01:01:04 UTC 2014
Hi,
If you try to edit the O2 (for example) of an existing dive (loaded from
the logbook, initially imported from a DC and inside no trip) and click
the "save" button, the O2 is reverted back to the original value.
I tried to fix the problem, but I have trouble to understand the code:
1. Since I have no selected trips (just a single dive that is not in a
trip), maintab.c:458-460 is copying the dive into
multiEditEquipmentPlaceholder and cylindersModel->setDive is called.
1. You can see in models.cpp:358 that we do no keep the pointer to
multiEditEquipmentPlaceholder, but just keep the dive id.
2. When the O2 field is changed, we modify it in cylinderAt(index), see
models.cpp:200:
1. cylinderAt gets the dive from ::getDiveById(currentId), see
models.cpp:162:
1. getDiveById gets the dive from the global dive_table (not
the multiEditEquipmentPlaceholder).
3. When I hit the save button, maintab.cpp:619 is executed and resets
the cylinder info to its original value, stored in the un-modified
multiEditEquipmentPlaceholder.
Frankly, I don't know what this multiEditEquipmentPlaceholder is for, I
don't understand why we don't store the dive in the CylindersModel
instance instead of its ID, I don't understand the logic of
MainTab::acceptChanges. That is too much unknown for me to come up with
a fix without re-working the whole code into something I can understand.
Can somebody explain to me or fix the problem?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20140107/38a15ae1/attachment.html>
More information about the subsurface
mailing list