Bug 653450 - gtkfilechooser crashes when added favorite

Ensure that display is set during drag-and-drop, and that string lists'
memory is zeroed after allocation to prevent g_strfreev() from
over-running.
This commit is contained in:
John Ralls 2011-07-03 16:40:03 -07:00 committed by Kristian Rietveld
parent cbc593bc22
commit 86794ce008
3 changed files with 4 additions and 4 deletions

View File

@ -121,10 +121,8 @@ make_list (const gchar *text,
}
if (list)
*list = g_new (gchar *, n_strings + 1);
*list = g_new0 (gchar *, n_strings + 1);
(*list)[n_strings] = NULL;
i = n_strings;
tmp_list = strings;
while (tmp_list)

View File

@ -147,6 +147,7 @@ struct _GtkDragFindData
selection_data.data = NULL;
selection_data.length = -1;
selection_data.target = _gtk_quartz_pasteboard_type_to_atom (type);
selection_data.display = gdk_display_get_default ();
if (gtk_target_list_find (info->target_list,
selection_data.target,

View File

@ -160,7 +160,8 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
selection_data = g_slice_new0 (GtkSelectionData);
selection_data->selection = selection;
selection_data->target = target;
if (!selection_data->display)
selection_data->display = gdk_display_get_default ();
if (target == gdk_atom_intern_static_string ("UTF8_STRING"))
{
NSString *s = [pasteboard stringForType:NSStringPboardType];