Crash when editing trip summary

Lubomir I. Ivanov neolit123 at gmail.com
Tue Dec 4 11:15:19 PST 2012


On 4 December 2012 19:14, Linus Torvalds <torvalds at linux-foundation.org> wrote:
>
> Looks sane for what it is, so..
>
> Acked-by: Linus Torvalds <torvalds at linux-foundation.org>
>
> That said, this is exactly the kind of code that would be better off
> *not* messing with the gtk tree structure at all, and instead just
> cause the whole gtk tree to be re-generated (see for example commit
> 544a8b9d7742: "Rewrite 'remove_autogen_trips()' without the gtk tree
> model walking").
>
> Then you just have to call dive_list_update_dives() afterwards, which
> re-generated the whole tree from our own data structures.
>
> In addition, often you'd want to also do
> remember_tree_state()/restore_tree_state() around the whole thing, so
> that it remembers which dive trips were expanded and which were not,
> so that when it re-generates the tree it also makes it look the same
> rather than collapse all trips.
>
> But that's a different patch entirely. Would you be willing to look at that?
>

this one should be applied instead of the previous patch.
i've made some smaller fixes along the way..

commit msg:
---------------------------
Merge trips without modifying the GTK tree

This patch does 4 small divelist.c changes in the following
order of importance:

1) In find_trip_by_time() now there is a check if a trip is actually found
before looking at the "when" flag.

2) Make remember_tree_state() slighly safer. If for example we have recently
deleted a trip from the linked list, it may still exist in the GTK tree model,
thus we want to check when calling find_trip_by_time() if there is an actual
match before setting the "expanded" flag for a trip.

3) When merging two trips in merge_trips_cb(), only use the tree model
to retrieve the timestamps (DIVE_DATE) and then find matching trips with
find_matching_trip(). Once we have pointers to the two trips to be merged,
move dives from one to another iterating with add_dive_to_trip().

4) In merge_trips_cb() - remember the tree state, repopulate the tree and
restore tree state, since now we are not adding/removing rows directly.
---------------------------

lubomir
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge_trips_fix2.patch
Type: application/octet-stream
Size: 3645 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20121204/5b2bdb17/attachment.obj>


More information about the subsurface mailing list