Re: [Patch] Fix for Bug #121152



On Sun, 2003-09-14 at 23:21, Martin Wehner wrote:
> Hello,
> 
> here's a patch that fixes Bug #121152 and other crashes in the context
> of moving/deleting files in a list view.

Thanks a lot!

> The model used by the list view uses the gsequence structure from the
> cut-n-paste-code directory to manage its collection of file references.
> gsequence.c is an implementation of a splay tree based sequence, which
> looks like it was lifted from glib, but I couldn't find any reference to
> it.

It was never in glib, but it was written by Soeren Sandmann in a way
such that it could be put in glib at a later point. 

> The node_remove method of gsequence doesn't update the count for the
> number of children the new root node has after removing a node from the
> tree. This field is pretty important for the rest of the algorithm and
> the list view model (through g_sequence_get_length()). This leads to all
> files in the sequence before the selected one getting discarded in the
> list view model. You don't notice it most of the time though, because
> the gtk_tree_model is correctly updated.
> 
> I guess this bug is responsible for quite a few delete/move/trash
> related crash reports in bugzilla, since it occurs every time one
> deletes/moves something in a list view (well, depends on the splay tree
> layout), but you get away without crashing most of the time.

Soeren, does this change seem ok to you? I didn't look at this code in
any detail.

> Index: gsequence.c
> ===================================================================
> RCS file: /cvs/gnome/nautilus/cut-n-paste-code/gsequence/gsequence.c,v
> retrieving revision 1.1
> diff -u -p -r1.1 gsequence.c
> --- gsequence.c 27 Jun 2003 16:21:34 -0000      1.1
> +++ gsequence.c 14 Sep 2003 19:52:15 -0000
> @@ -914,7 +914,10 @@ g_sequence_node_remove        (GSequence
>         right->parent = node->parent;
>         right->left = left;
>         if (left)
> +       {
>             left->parent = right;
> +           g_sequence_node_update_fields (right);
> +       }
>      }
>      else if (left)
>         left->parent = node->parent;
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a world-famous vegetarian cyborg She's a green-fingered gold-digging 
queen of the dead with an evil twin sister. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]