diff options
author | Jean Guyomarc'h <jean.guyomarch@openwide.fr> | 2015-10-15 10:41:38 +0200 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2015-12-01 12:15:32 -0800 |
commit | 69ed0d889c44dc4ef27a87f69bbe3c31fc2e04b6 (patch) | |
tree | 6f1b50e871c70e1dbb93408e6c230a3f786addfd | |
parent | 2f883ba1514438f31be2ed8b2f8f1591ae0b3c78 (diff) |
ecore_cocoa_cnp: make API thread-safe
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r-- | src/lib/ecore_cocoa/ecore_cocoa_cnp.m | 11 |
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 605bfa9299..efe3cbdbef 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 |
@@ -68,7 +66,7 @@ ecore_cocoa_selection_clipboard_get(int *size, | |||
68 | Ecore_Cocoa_Cnp_Type type, | 66 | Ecore_Cocoa_Cnp_Type type, |
69 | Ecore_Cocoa_Cnp_Type *retrieved_types) | 67 | Ecore_Cocoa_Cnp_Type *retrieved_types) |
70 | { | 68 | { |
71 | static NSMutableArray *classes = nil; | 69 | NSMutableArray *classes; |
72 | void *data; | 70 | void *data; |
73 | NSDictionary *options; | 71 | NSDictionary *options; |
74 | NSPasteboard *pb; | 72 | NSPasteboard *pb; |
@@ -77,8 +75,7 @@ ecore_cocoa_selection_clipboard_get(int *size, | |||
77 | BOOL string_class = NO; | 75 | BOOL string_class = NO; |
78 | Ecore_Cocoa_Cnp_Type types = 0; | 76 | Ecore_Cocoa_Cnp_Type types = 0; |
79 | 77 | ||
80 | if (!classes) | 78 | classes = [[NSMutableArray alloc] init]; |
81 | classes = [[NSMutableArray alloc] init]; | ||
82 | 79 | ||
83 | if ((type & ECORE_COCOA_CNP_TYPE_STRING) || | 80 | if ((type & ECORE_COCOA_CNP_TYPE_STRING) || |
84 | (type & ECORE_COCOA_CNP_TYPE_MARKUP)) | 81 | (type & ECORE_COCOA_CNP_TYPE_MARKUP)) |