[gtk+/gtk-2-24-quartz: 17/26] Force an ownerChanged notification when we destroy a widget with a selection, and act on the notific



commit de82a1d0aa03750864af17a9fe34011d22da8c80
Author: John Ralls <jralls ceridwen us>
Date:   Fri Dec 31 17:35:14 2010 -0800

    Force an ownerChanged notification when we destroy a widget with a selection, and act on the notification in DnD. This should prevent CF trying to retrieve any deferred pasteboard types later, and DnD crashing if it does.

 gtk/gtkdnd-quartz.c       |   10 +++++++++-
 gtk/gtkselection-quartz.c |    4 +++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index 8247f06..bd97fc0 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -148,7 +148,8 @@ struct _GtkDragFindData
 {
   guint target_info;
   GtkSelectionData selection_data;
-
+  g_return_if_fail(info->source_widget != NULL);
+  g_return_if_fail(info->target_list != NULL);
   selection_data.selection = GDK_NONE;
   selection_data.data = NULL;
   selection_data.length = -1;
@@ -171,6 +172,13 @@ struct _GtkDragFindData
     }
 }
 
+- (void)pasteboardChangedOwner: (NSPasteboard*)sender
+{
+    info->target_list = NULL;
+    info->widget = NULL;
+    info->source_widget = NULL;
+}
+
 - (id)initWithInfo:(GtkDragSourceInfo *)anInfo
 {
   self = [super init];
diff --git a/gtk/gtkselection-quartz.c b/gtk/gtkselection-quartz.c
index a47d5e1..1ce7d55 100644
--- a/gtk/gtkselection-quartz.c
+++ b/gtk/gtkselection-quartz.c
@@ -560,7 +560,9 @@ gtk_selection_info_remove (GdkAtom selection, GtkWidget *owner)
       
       if (selection_info->selection == selection &&
 	  selection_info->owner == owner)
-	{	
+	{
+	  GtkClipboard *clip = gtk_clipboard_get(selection_info->selection);
+	  gtk_clipboard_clear(clip);
 	  current_selections = g_list_remove_link (current_selections,
 						   tmp_list);
 	  g_list_free (tmp_list);



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