help on fixing a ghost cylinder bug.
jlmulder at planet.nl
Thu Mar 20 14:03:51 PDT 2014
Not a solution yet, but some more observations.
On 20-03-14 17:53, Tomaz Canabrava wrote:
> So, I was playing with Dirk's DiveLog and I found a rather serious bug
> and started digging, and I'm a bit lost on how to solve it.
> The bug:
> Create two cylinders and edit them, o2, n2, then save. *some* values
> makes the cylinder count on the dive go crazy ( I use 32 as the 02
> value and it jumps from 2 to 7 on dirk's dive n 222.
As a beginner on this list, I do not know how to access the mentioned
dive nr 222, so I tried to recreate the problem as described above.
However, I have not been able to reproduce the issue, but there are more
strange things going on in the cylinder handling that might be related
to issue as described by Tomaz.
> What I managed to discover:
> The Edit is fine, we are actually editing the right cylinder.
> The backup copy is fine, both dives ( copy and original ) have the
> correct data
> The issue sems to be on the fixup_dive code, more important on the
> 'check_for_unused_tanks', that calls 'mark_used_tanks'. Now, before
> this call, the last cylinder ID of a used dive is 1, after the call,
> it's 6.
> and since on the model we have code that counts untill the last valud
> ( or used ) tank, we jump from 2 to 7 tanks being displayed on the
> model, just by changing the 02 of a tank.
> This is a tiny bit out of the scope that I usually help on subsurface
> and I didn't understand how it should be fixed.
> any help, appreciated.
I discovered the following:
Added 2 cylinders to a dive, and did not add any gas change event in the
profile. Tried to remove 2nd-ly added cylinder, and got the dialog "the
gas is in use and cannot be removed". Obviously a bug.
Restarted the application, and now only 1 cylinder is shown. I'm using
latest master and I'm using the git store for the dives. A check of the
stored git data shows 2 cylinders. Things even get stranger, because I
can add a gas change event for both cylinders, and the 2nd added
cylinder (the one I'm switching to) appears in the Equipment tab when
adding a gas change event.
Tomorrow, I will investigate a little further.
More information about the subsurface