[gtk+/gtk-2-24] quartz: really don't call a NULL function in gtk_clipboard_store()



commit bc3f1893aa26761c0009ddc993b48623bcfbe4ed
Author: Michael Natterer <mitch lanedo com>
Date:   Tue Jan 15 11:48:23 2013 +0100

    quartz: really don't call a NULL function in gtk_clipboard_store()
    
    Need to check targets and get_func in each loop iteration because
    calling get_func the fist time might do whatever to the clipboard.
    Re-fixes bug #626499. Also free the target table after we're done.

 gtk/gtkclipboard-quartz.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkclipboard-quartz.c b/gtk/gtkclipboard-quartz.c
index 0cf5356..cd6f878 100644
--- a/gtk/gtkclipboard-quartz.c
+++ b/gtk/gtkclipboard-quartz.c
@@ -1063,6 +1063,13 @@ gtk_clipboard_store (GtkClipboard *clipboard)
     {
       GtkSelectionData selection_data;
 
+      /* in each loop iteration, check if the content is still
+       * there, because calling get_func() can do anything to
+       * the clipboard
+       */
+      if (!clipboard->target_list || !clipboard->get_func)
+        break;
+
       memset (&selection_data, 0, sizeof (GtkSelectionData));
 
       selection_data.selection = clipboard->selection;
@@ -1079,6 +1086,9 @@ gtk_clipboard_store (GtkClipboard *clipboard)
 
       g_free (selection_data.data);
     }
+
+  if (targets)
+    gtk_target_table_free (targets, n_targets);
 }
 
 void



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