[gtk+] Remove gtk_paste_point_override mark if we don't insert any text.



commit b7de18ab35e587df98032eaaa3d159d8f8fd64f4
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jan 28 13:24:26 2011 +0100

    Remove gtk_paste_point_override mark if we don't insert any text.
    
    This patch fixes bug #590459.

 gtk/gtktextbuffer.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index 3a45357..58ca341 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -3292,9 +3292,7 @@ get_paste_point (GtkTextBuffer *buffer,
       gtk_text_buffer_get_iter_at_mark (buffer, &insert_point,
                                         paste_point_override);
       if (clear_afterward)
-        gtk_text_buffer_delete_mark (buffer,
-                                     gtk_text_buffer_get_mark (buffer,
-                                                               "gtk_paste_point_override"));
+        gtk_text_buffer_delete_mark (buffer, paste_point_override);
     }
   else
     {
@@ -3393,6 +3391,18 @@ clipboard_text_received (GtkClipboard *clipboard,
 
       emit_paste_done (buffer, clipboard);
     }
+  else
+    {
+      /* It may happen that we set a point override but we are not inserting
+         any text, so we must remove it afterwards */
+      GtkTextMark *paste_point_override;
+
+      paste_point_override = gtk_text_buffer_get_mark (buffer,
+                                                       "gtk_paste_point_override");
+
+      if (paste_point_override != NULL)
+        gtk_text_buffer_delete_mark (buffer, paste_point_override);
+    }
 
   free_clipboard_request (request_data);
 }



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