Fix memory management of types array

Also add autorelease pool to gtk_drag_begin_idle().
This commit is contained in:
Kristian Rietveld 2009-12-30 14:18:33 +01:00
parent c12dbae0ac
commit f91907101d
2 changed files with 7 additions and 2 deletions

View File

@ -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;

View File

@ -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;
}