summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-15 10:41:38 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-10 08:32:49 +0100
commitdbe57695ef956d2fd3cb24fa60a10c5f027e3c64 (patch)
treeecac8735327d86d8890074ddcb1d360cc6a48f36
parentc17971bc807929a6cafea752d7483c97a3dd4619 (diff)
ecore_cocoa_cnp: make API thread-safe
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_cnp.m11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_cnp.m b/src/lib/ecore_cocoa/ecore_cocoa_cnp.m
index 600c4c1a49..b18901b95a 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_cnp.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_cnp.m
@@ -14,13 +14,11 @@ ecore_cocoa_selection_clipboard_set(const void *data,
14 int size, 14 int size,
15 Ecore_Cocoa_Cnp_Type type) 15 Ecore_Cocoa_Cnp_Type type)
16{ 16{
17 static NSMutableArray *objects = nil; 17 NSMutableArray *objects;
18 NSString *str = nil; 18 NSString *str = nil;
19 BOOL ok = YES; 19 BOOL ok = YES;
20 20
21 if (!objects) 21 objects = [[NSMutableArray alloc] init];
22 objects = [[NSMutableArray alloc] init];
23
24 if (type & ECORE_COCOA_CNP_TYPE_STRING) 22 if (type & ECORE_COCOA_CNP_TYPE_STRING)
25 { 23 {
26 str = [[NSString alloc] initWithBytes: data 24 str = [[NSString alloc] initWithBytes: data
@@ -69,7 +67,7 @@ ecore_cocoa_selection_clipboard_get(int *size,
69 Ecore_Cocoa_Cnp_Type type, 67 Ecore_Cocoa_Cnp_Type type,
70 Ecore_Cocoa_Cnp_Type *retrieved_types) 68 Ecore_Cocoa_Cnp_Type *retrieved_types)
71{ 69{
72 static NSMutableArray *classes = nil; 70 NSMutableArray *classes;
73 void *data; 71 void *data;
74 NSDictionary *options; 72 NSDictionary *options;
75 NSPasteboard *pb; 73 NSPasteboard *pb;
@@ -78,8 +76,7 @@ ecore_cocoa_selection_clipboard_get(int *size,
78 BOOL string_class = NO; 76 BOOL string_class = NO;
79 Ecore_Cocoa_Cnp_Type types = 0; 77 Ecore_Cocoa_Cnp_Type types = 0;
80 78
81 if (!classes) 79 classes = [[NSMutableArray alloc] init];
82 classes = [[NSMutableArray alloc] init];
83 80
84 if ((type & ECORE_COCOA_CNP_TYPE_STRING) || 81 if ((type & ECORE_COCOA_CNP_TYPE_STRING) ||
85 (type & ECORE_COCOA_CNP_TYPE_MARKUP)) 82 (type & ECORE_COCOA_CNP_TYPE_MARKUP))