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 committed by Tristan Van Berkom
parent b48c8318a1
commit 80a015529d
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->target_list = gtk_target_list_new (targets, n_targets);
[clipboard->pasteboard declareTypes:types owner:owner]; [clipboard->pasteboard declareTypes:types owner:owner];
[types release];
[pool release]; [pool release];
return TRUE; return TRUE;

View File

@ -455,7 +455,9 @@ register_types (GtkWidget *widget, GtkDragDestSite *site)
pool = [[NSAutoreleasePool alloc] init]; pool = [[NSAutoreleasePool alloc] init];
types = _gtk_quartz_target_list_to_pasteboard_types (site->target_list); types = _gtk_quartz_target_list_to_pasteboard_types (site->target_list);
[nswindow registerForDraggedTypes:types]; [nswindow registerForDraggedTypes:[types copy]];
[types release];
[pool release]; [pool release];
} }
} }
@ -1063,6 +1065,7 @@ gtk_drag_dest_find_target (GtkWidget *widget,
static gboolean static gboolean
gtk_drag_begin_idle (gpointer arg) gtk_drag_begin_idle (gpointer arg)
{ {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
GdkDragContext* context = (GdkDragContext*) arg; GdkDragContext* context = (GdkDragContext*) arg;
GtkDragSourceInfo* info = gtk_drag_get_source_info (context, FALSE); GtkDragSourceInfo* info = gtk_drag_get_source_info (context, FALSE);
NSWindow *nswindow; NSWindow *nswindow;
@ -1096,6 +1099,8 @@ gtk_drag_begin_idle (gpointer arg)
[info->nsevent release]; [info->nsevent release];
[pool release];
return FALSE; return FALSE;
} }