From 875e6f4bdbb8f4ee02fff11febbdca425ff915b0 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Mon, 25 Jul 2011 22:02:25 +0200 Subject: [PATCH] Bug 508601 - Copying from GTK+ applications causes crash In GtkClipboardOwner pasteboard:provideDataForType do not call _gtk_quartz_set_selection_data_for_pasteboard() is selection_data.length is smaller than 0. The function relies on having a positive length, since it stores the length in a uint ... --- gtk/gtkclipboard-quartz.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk/gtkclipboard-quartz.c b/gtk/gtkclipboard-quartz.c index 4b57d774fe..b18165cfd1 100644 --- a/gtk/gtkclipboard-quartz.c +++ b/gtk/gtkclipboard-quartz.c @@ -109,9 +109,10 @@ struct _GtkClipboardClass clipboard->get_func (clipboard, &selection_data, info, clipboard->user_data); - - _gtk_quartz_set_selection_data_for_pasteboard (clipboard->pasteboard, - &selection_data); + + if (selection_data.length >= 0) + _gtk_quartz_set_selection_data_for_pasteboard (clipboard->pasteboard, + &selection_data); g_free (selection_data.data); }