[BUG] Default sorting order and deleting a trip, while switching sorting orders

Dirk Hohndel dirk at hohndel.org
Tue Feb 19 10:20:59 PST 2013


Linus Torvalds <torvalds at linux-foundation.org> writes:

> On Tue, Feb 19, 2013 at 9:10 AM, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>> just noticed a couple of things, which might have been lurking for
>> quite some time.
>
> Yeah, these are not new.
>
>> 1) (more of a nitpick) the default sorting order in the divelog isn't
>> correctly indicated when the app. is first started.
>
> This is normal gtk behavior. The initial ordering isn't really a
> "sorted" order, it's just the native order of the tree model (ie the
> order we've filled it in). The fact that we our native order is the
> same as the trip-date order is just happenstance.
>
>> 2) there is strange bug if you do the following:
>>
>> - ./subsurface ./dives/*
>> - log menu -> enable "autogroup"
>> - click on the "location" column title
>> - now click back on the "#" column title
>> (the test dives should be packed into 4 trips at this point)
>> - right click on the trip with 15 dives and "delete trip" it
>> - only one dive pops out after the trip is deleted
>> (should happen for all trips)
>
> Ugh. I can't follow the "play games with gtk model iterators" etc
> crap. We've tried to move away from it, but we still do it in a few
> places. The "remove trip" is one such case.
>
> The attached patch gets rid of all the gtk model games, and replaces
> it with just working with our own data structures instead. It then
> just does the whole
>
>     remember_tree_state()
>
>     ...
>
>     dive_list_update_dives();
>     restore_tree_state();
>
> dance around it, and we're all good. Much simpler and more straightforward.
>
> Dirk, we have a few other cases of this going on, like the whole
> "move_dive_between_trips()" and "merge_dive_into_trip_above_cb()"
> where we play games with the gtk dive model instead of just working on
> our own data structure and re-creating the model from that.  I really
> think they should all be rewritten, because as Lubomir's test-case
> shows, the gtk tree model code is very fragile. It *sometimes* works,
> but it's very unclear when it works and when it doesn't. I couldn't
> even start to debug the gtk tree-model version, while my rewritten
> "remove_trip()" is very simple.

I completely agree. You and I talked about a complete rewrite there in
Spain... today may not be the best day to do that, though :-)

> Oh, and I changed "remove_dive_from_trip()" to set
>
>      dive->tripflag = NO_TRIP;
>
> instead of TF_NOTRIP because otherwise we just auto-regenerates the
> trip again ;)

:-/

This has no SOB... do you want me to apply it?

What's your confidence level on "solves bug" vs. "causes possible new
ones"?

/D


More information about the subsurface mailing list