Index: gtk/gtktreeview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.c,v
retrieving revision 1.434
diff -u -p -r1.434 gtktreeview.c
--- gtk/gtktreeview.c	1 Feb 2005 18:15:09 -0000	1.434
+++ gtk/gtktreeview.c	10 Feb 2005 18:12:12 -0000
@@ -42,6 +42,7 @@
 #include "gtkentry.h"
 #include "gtkframe.h"
 #include "gtktreemodelsort.h"
+#include "gtkprivate.h"
 
 #define GTK_TREE_VIEW_PRIORITY_VALIDATE (GDK_PRIORITY_REDRAW + 5)
 #define GTK_TREE_VIEW_PRIORITY_SCROLL_SYNC (GTK_TREE_VIEW_PRIORITY_VALIDATE + 2)
@@ -10195,12 +10196,20 @@ gtk_tree_view_scroll_to_cell (GtkTreeVie
    * scrolling code, we short-circuit validate_visible_area's immplementation as
    * it is much slower than just going to the point.
    */
-  if (! GTK_WIDGET_REALIZED (tree_view) ||
+    if (!GTK_WIDGET_VISIBLE (tree_view) || GTK_WIDGET_ALLOC_NEEDED (tree_view) ||
       GTK_RBNODE_FLAG_SET (tree_view->priv->tree->root, GTK_RBNODE_DESCENDANTS_INVALID))
     {
       if (tree_view->priv->scroll_to_path)
 	gtk_tree_row_reference_free (tree_view->priv->scroll_to_path);
 
+      /* Unset top row reference since we are going to scroll to new row 
+      to avoid race conditions */
+      if (tree_view->priv->top_row)
+        {
+          gtk_tree_row_reference_free (tree_view->priv->top_row);
+	  tree_view->priv->top_row = NULL;
+	}
+
       tree_view->priv->scroll_to_path = NULL;
       tree_view->priv->scroll_to_column = NULL;
 
