[Xfce4-commits] <xfce4-clipman-plugin:master> [daemon] Fix bad assumption that I could free/copy the selection

Mike Massonnet noreply at xfce.org
Wed Dec 9 08:22:02 CET 2009


Updating branch refs/heads/master
         to cf74c1d1d1f4bfe70c3e7dcd2744d13b85715de0 (commit)
       from 1796ad49f7a7d99800fc1ed4d88f3961b66975c9 (commit)

commit cf74c1d1d1f4bfe70c3e7dcd2744d13b85715de0
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Wed Dec 9 08:15:05 2009 +0100

    [daemon] Fix bad assumption that I could free/copy the selection
    
    The code handling the get-selection callback was changed to free the
    selection and than copy the cached selection into it. This was baaad as
    it made further calls to the get-selection callback when freeing the
    selection which ended in a crash. The code has been switched back to the
    heavier version of calling the set function.

 daemon/gsd-clipboard-manager.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/daemon/gsd-clipboard-manager.c b/daemon/gsd-clipboard-manager.c
index 3e3097b..4d848d8 100644
--- a/daemon/gsd-clipboard-manager.c
+++ b/daemon/gsd-clipboard-manager.c
@@ -134,8 +134,12 @@ default_clipboard_get_func (GtkClipboard *clipboard,
         if (selection_data_cache == NULL) {
                 return;
         }
-        gtk_selection_data_free (selection_data);
-        selection_data = gtk_selection_data_copy (selection_data_cache);
+
+        gtk_selection_data_set (selection_data,
+                                gtk_selection_data_get_target (selection_data_cache),
+                                gtk_selection_data_get_format (selection_data_cache),
+                                gtk_selection_data_get_data (selection_data_cache),
+                                gtk_selection_data_get_length (selection_data_cache));
 }
 
 static void
@@ -145,7 +149,6 @@ default_clipboard_clear_func (GtkClipboard *clipboard,
         return;
 }
 
-
 static void
 default_clipboard_restore (GsdClipboardManager *manager)
 {



More information about the Xfce4-commits mailing list