[PATCH] Fix mixed dive/trip tree model grouping

Linus Torvalds torvalds at linux-foundation.org
Wed Jan 2 09:52:43 PST 2013


In commit 96db56f89c76 ("Allow overlapping (and disjoint) dive trips")
I allowed dives to be part of arbitrary dive trips regardless of date,
which meant that the divelist tree model code needed to find the right
parent for a dive as it was inserted.

That code stupidly assumed that the top level of the dive list tree
containted *only* trips, which is not at all the case. It happens to
be true it you group all your dives into divetrips (the common case
for autogroup=1, which real users do tend to have), but now that Dirk
made the autogrouping be a per-xml-file setting, it became much easier
to trigger the "mixed trips and non-trip dives" case, and that showed
the stupid bug with the test dives.

So instead of just blindly iterating to the 'n'th entry, search for
the actual entry that is the dive trip we want to associate a dive
with.

Reported-by: Lubomir Ivanov <neolit123 at gmail.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
On Wed, Jan 2, 2013 at 9:46 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> I'll send a patch with a proper commit message etc to fix it asap.

This should do it. I on purpose forced us to re-lookup the parent
every time (even though the common case is that it's the same as the
last time) to show these kinds of issues. But then I hadn't even
thought about the "dives at the top level" case. Oops.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 864 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130102/a2d2da9d/attachment.obj>


More information about the subsurface mailing list