Index: gtk/gtktextview.c
===================================================================
--- gtk/gtktextview.c	(revision 17180)
+++ gtk/gtktextview.c	(working copy)
@@ -294,8 +294,7 @@
 static void     gtk_text_view_start_selection_drag   (GtkTextView        *text_view,
                                                       const GtkTextIter  *iter,
                                                       GdkEventButton     *event);
-static gboolean gtk_text_view_end_selection_drag     (GtkTextView        *text_view,
-                                                      GdkEventButton     *event);
+static gboolean gtk_text_view_end_selection_drag     (GtkTextView        *text_view);
 static void     gtk_text_view_start_selection_dnd    (GtkTextView        *text_view,
                                                       const GtkTextIter  *iter,
                                                       GdkEventMotion     *event);
@@ -3723,7 +3722,7 @@
 {
   if (!was_grabbed)
     {
-      gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget), NULL);
+      gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget));
       gtk_text_view_unobscure_mouse_cursor (GTK_TEXT_VIEW (widget));
     }
 }
@@ -4041,7 +4040,7 @@
     {
       GtkTextIter iter;
 
-      gtk_text_view_end_selection_drag (text_view, event);      
+      gtk_text_view_end_selection_drag (text_view);
 
       gtk_text_layout_get_iter_at_pixel (text_view->layout,
 					 &iter,
@@ -4073,7 +4072,7 @@
           text_view->drag_start_y = -1;
         }
 
-      if (gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget), event))
+      if (gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget)))
         return TRUE;
       else if (text_view->pending_place_cursor_button == event->button)
         {
@@ -4140,6 +4139,8 @@
 {
   GtkTextView *text_view = GTK_TEXT_VIEW (widget);
 
+  gtk_text_view_end_selection_drag (text_view);
+
   gtk_widget_queue_draw (widget);
 
   DV(g_print (G_STRLOC": focus_out_event\n"));
@@ -5876,8 +5877,7 @@
 
 /* returns whether we were really dragging */
 static gboolean
-gtk_text_view_end_selection_drag (GtkTextView    *text_view, 
-				  GdkEventButton *event)
+gtk_text_view_end_selection_drag (GtkTextView    *text_view) 
 {
   if (text_view->selection_drag_handler == 0)
     return FALSE;
@@ -6096,7 +6096,7 @@
         }
       
       gtk_text_view_stop_cursor_blink (text_view);
-      gtk_text_view_end_selection_drag (text_view, NULL);
+      gtk_text_view_end_selection_drag (text_view);
 
       g_object_unref (text_view->layout);
       text_view->layout = NULL;
