ecore_cocoa_cnp: make API thread-safe
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>
Thu, 15 Oct 2015 08:41:38 +0000 (10:41 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 1 Dec 2015 20:15:32 +0000 (12:15 -0800)
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/ecore_cocoa/ecore_cocoa_cnp.m

index 605bfa9..efe3cbd 100644 (file)
@@ -14,13 +14,11 @@ ecore_cocoa_selection_clipboard_set(const void           *data,
                                     int                   size,
                                     Ecore_Cocoa_Cnp_Type  type)
 {
-   static NSMutableArray *objects = nil;
+   NSMutableArray *objects;
    NSString *str = nil;
    BOOL ok = YES;
 
-   if (!objects)
-     objects = [[NSMutableArray alloc] init];
-
+   objects = [[NSMutableArray alloc] init];
    if (type & ECORE_COCOA_CNP_TYPE_STRING)
      {
         str = [[NSString alloc] initWithBytes: data
@@ -68,7 +66,7 @@ ecore_cocoa_selection_clipboard_get(int                  *size,
                                     Ecore_Cocoa_Cnp_Type  type,
                                     Ecore_Cocoa_Cnp_Type *retrieved_types)
 {
-   static NSMutableArray *classes = nil;
+   NSMutableArray *classes;
    void *data;
    NSDictionary *options;
    NSPasteboard *pb;
@@ -77,8 +75,7 @@ ecore_cocoa_selection_clipboard_get(int                  *size,
    BOOL string_class = NO;
    Ecore_Cocoa_Cnp_Type types = 0;
 
-   if (!classes)
-     classes = [[NSMutableArray alloc] init];
+   classes = [[NSMutableArray alloc] init];
 
    if ((type & ECORE_COCOA_CNP_TYPE_STRING) ||
        (type & ECORE_COCOA_CNP_TYPE_MARKUP))