[Patch] Fix for Bug #121152



Hello,

here's a patch that fixes Bug #121152 and other crashes in the context
of moving/deleting files in a list view.

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.

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.

Martin

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;





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