help on fixing a ghost cylinder bug.

Tomaz Canabrava tcanabrava at
Thu Mar 20 09:53:11 PDT 2014

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.

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

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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the subsurface mailing list