Re: [Patch] Fix for Bug #121152



Alexander Larsson <alexl redhat com> writes:

> > 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.

Actually g_sequence_node_remove() looks pretty botched to me. Not only
doesn't it update the n_children field, it also updates right->left
even if there already was a right->left node. Amazing it worked at
all.

My network connection is bad at the moment, so I can't check out
nautilus and provide a proper patch, but here is new version of
g_sequence_node_remove() that I think should work. It passed the test
I have in my copy of GSequence.

Thanks for finding this, Martin.


static void
g_sequence_node_remove        (GSequenceNode *node)
{
    GSequenceNode *right, *left;
    
    splay (node);

    if (node->right)
	g_assert (node->right->left != node);
    
    left = node->left;
    right = node->right;

    node->left = node->right = NULL;

    g_assert (left != node);
    g_assert (right != node);
    
    g_assert (node->parent == NULL);

    if (left)
	left->parent = right;
    
    if (right)
    {
	right->parent = NULL;
	
	/* make right the new root */
	right = g_sequence_node_find_first (right);

	g_assert (right->left == NULL);
    
	right->parent = NULL;
	right->left = left;

	g_sequence_node_update_fields (right);
   }
}


Søren



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