diff options
author | Richard Hult <richard@imendio.com> | 2008-05-25 15:11:11 +0000 |
---|---|---|
committer | Richard Hult <rhult@src.gnome.org> | 2008-05-25 15:11:11 +0000 |
commit | 18e3aedbf06f939044280ec29f0f6c7723d7977d (patch) | |
tree | c1a9a407d94b6957f184696f379e2568248d88c8 /gtk/gtkdnd-quartz.c | |
parent | 1d946af2f3cbbf14e4ebd97a71dfe4b3816e1275 (diff) | |
download | gtk+-18e3aedbf06f939044280ec29f0f6c7723d7977d.tar.gz |
Run gtk_drag_source_info_destroy in an idle, workaround for bug #501588,
2008-05-25 Richard Hult <richard@imendio.com>
* gtk/gtkdnd-quartz.c: (gtk_drag_drop_finished): Run
gtk_drag_source_info_destroy in an idle, workaround for bug
#501588, that makes any code that uses the context returned from
gtk_drag_begin() crash, like treeview/iconview dnd.
(GdkDragSourceOwner::provideDataForType): only use the data if we
got any.
svn path=/trunk/; revision=20151
Diffstat (limited to 'gtk/gtkdnd-quartz.c')
-rw-r--r-- | gtk/gtkdnd-quartz.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c index 4bfc34e7f2..a443d2ee06 100644 --- a/gtk/gtkdnd-quartz.c +++ b/gtk/gtkdnd-quartz.c @@ -143,6 +143,7 @@ struct _GtkDragFindData selection_data.selection = GDK_NONE; selection_data.data = NULL; + selection_data.length = -1; selection_data.target = _gtk_quartz_pasteboard_type_to_atom (type); if (gtk_target_list_find (info->target_list, @@ -155,7 +156,8 @@ struct _GtkDragFindData target_info, time); - _gtk_quartz_set_selection_data_for_pasteboard (sender, &selection_data); + if (selection_data.length >= 0) + _gtk_quartz_set_selection_data_for_pasteboard (sender, &selection_data); g_free (selection_data.data); } @@ -1769,10 +1771,21 @@ gtk_drag_source_info_destroy (GtkDragSourceInfo *info) g_free (info); } +static gboolean +drag_drop_finished_idle_cb (gpointer data) +{ + gtk_drag_source_info_destroy (data); + return FALSE; +} + static void gtk_drag_drop_finished (GtkDragSourceInfo *info) { - gtk_drag_source_info_destroy (info); + /* Workaround for the fact that the NS API blocks until the drag is + * over. This way the context is still valid when returning from + * drag_begin, even if it will still be quite useless. See bug #501588. + */ + g_idle_add (drag_drop_finished_idle_cb, info); } /************************************************************* |