diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index caa517c..e180263 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -14329,11 +14329,11 @@ gtk_tree_view_search_button_press_event (GtkWidget *widget,
 {
   g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
 
-  gtk_tree_view_search_dialog_hide (widget, tree_view);
-
   if (event->window == tree_view->priv->bin_window)
     gtk_tree_view_button_press (GTK_WIDGET (tree_view), event);
 
+  gtk_tree_view_search_dialog_hide (widget, tree_view);
+
   return TRUE;
 }
 
