[gtk+] Fix memory management of types array
- From: Kristian Rietveld <kristian src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Fix memory management of types array
- Date: Wed, 30 Dec 2009 13:22:57 +0000 (UTC)
commit f91907101d12f4f8808f4024b462820543ccccf6
Author: Kristian Rietveld <kris gtk org>
Date: Wed Dec 30 14:18:33 2009 +0100
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 2868747..d0cc562 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 275ebba..f01a71f 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]