[PATCH] Remove useless members of DiveItem

Dirk Hohndel dirk at hohndel.org
Thu Apr 25 08:33:01 PDT 2013


On Thu, 2013-04-25 at 08:29 -0700, Linus Torvalds wrote:
> On Thu, Apr 25, 2013 at 8:25 AM, Linus Torvalds
> <torvalds at linux-foundation.org> wrote:
> >
> > So the reason we did it like we did in the gtk version was that all
> > the cell renderer and treeview stuff is %$#! confusing, and I started
> > out without specialty renderers. I'm not sure it's the only way to do
> > it, though.
> 
> Btw, when it comes to the Qt interface, I'm not at all sure that it's
> a great idea to embed the dive pointer into the qt data structures.
> When we delete dives, how do we guarantee that the qt data structures
> are all gone and forgotten before we've free'd the dive data
> structure.
> 
> So I wonder if the qt data structures shouldn't contain the index to
> the dive table, and then the accessor functions would look up the dive
> from that. That way we wouldn't have (potentially stale) pointers in
> the Qt data structures.

I thought about this last night. The only time we ever free a dive is if
we delete it. So all we need to make sure is that we remove it from the
model BEFORE we free the memory. That doesn't seem like a tough
constraint to implement.

And index on the other hand can cause very subtle problems. Let's say
you merged two dives. Now all the following indices are WRONG.

Am I missing something obvious?

/D



More information about the subsurface mailing list