summaryrefslogtreecommitdiff
path: root/gtk/gtkclipboard-quartz.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@gtk.org>2010-01-01 20:39:57 +0100
committerKristian Rietveld <kris@gtk.org>2010-01-01 21:28:16 +0100
commitc049c6a38507fe4279a51422fb65d77cd8be8b8a (patch)
tree2eebf44eab8936eddc89ab4fcd3b4294e6165e98 /gtk/gtkclipboard-quartz.c
parent693124500386628e2a26533bcfbb453b10d253ae (diff)
downloadgtk+-c049c6a38507fe4279a51422fb65d77cd8be8b8a.tar.gz
Rework a previous commit to not crash in addition to fixing leaks
The target list/entry to pasteboard entry conversions return a NSSet now instead of NSArray.
Diffstat (limited to 'gtk/gtkclipboard-quartz.c')
-rw-r--r--gtk/gtkclipboard-quartz.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gtk/gtkclipboard-quartz.c b/gtk/gtkclipboard-quartz.c
index d0cc562625..4b57d774fe 100644
--- a/gtk/gtkclipboard-quartz.c
+++ b/gtk/gtkclipboard-quartz.c
@@ -328,15 +328,13 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
gboolean have_owner)
{
GtkClipboardOwner *owner;
- NSArray *types;
+ NSSet *types;
NSAutoreleasePool *pool;
pool = [[NSAutoreleasePool alloc] init];
owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
- types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
-
if (!(clipboard->have_owner && have_owner) ||
clipboard->user_data != user_data)
{
@@ -351,10 +349,14 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
clipboard->user_data != user_data)
{
(*clear_func) (clipboard, user_data);
+ [pool release];
return FALSE;
}
else
- return TRUE;
+ {
+ [pool release];
+ return TRUE;
+ }
}
}
@@ -369,7 +371,9 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
gtk_target_list_unref (clipboard->target_list);
clipboard->target_list = gtk_target_list_new (targets, n_targets);
- [clipboard->pasteboard declareTypes:types owner:owner];
+ types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
+
+ [clipboard->pasteboard declareTypes:[types allObjects] owner:owner];
[types release];
[pool release];