From 80a015529d25372e4fd11ed82b5514ef2730346d Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Wed, 30 Dec 2009 14:18:33 +0100 Subject: [PATCH] Fix memory management of types array Also add autorelease pool to gtk_drag_begin_idle(). --- gtk/gtkclipboard-quartz.c | 2 +- gtk/gtkdnd-quartz.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gtk/gtkclipboard-quartz.c b/gtk/gtkclipboard-quartz.c index 2868747826..d0cc562625 100644 --- a/gtk/gtkclipboard-quartz.c +++ b/gtk/gtkclipboard-quartz.c @@ -370,7 +370,7 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard, clipboard->target_list = gtk_target_list_new (targets, n_targets); [clipboard->pasteboard declareTypes:types owner:owner]; - + [types release]; [pool release]; return TRUE; diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c index 275ebba0bd..f01a71fd34 100644 --- a/gtk/gtkdnd-quartz.c +++ b/gtk/gtkdnd-quartz.c @@ -455,7 +455,9 @@ register_types (GtkWidget *widget, GtkDragDestSite *site) pool = [[NSAutoreleasePool alloc] init]; types = _gtk_quartz_target_list_to_pasteboard_types (site->target_list); - [nswindow registerForDraggedTypes:types]; + [nswindow registerForDraggedTypes:[types copy]]; + + [types release]; [pool release]; } } @@ -1063,6 +1065,7 @@ gtk_drag_dest_find_target (GtkWidget *widget, static gboolean gtk_drag_begin_idle (gpointer arg) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; GdkDragContext* context = (GdkDragContext*) arg; GtkDragSourceInfo* info = gtk_drag_get_source_info (context, FALSE); NSWindow *nswindow; @@ -1096,6 +1099,8 @@ gtk_drag_begin_idle (gpointer arg) [info->nsevent release]; + [pool release]; + return FALSE; }