]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
In libobjc/: 2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
authorNicola Pero <nicola.pero@meta-innovation.com>
Sun, 19 Dec 2010 19:10:26 +0000 (19:10 +0000)
committerNicola Pero <nicola@gcc.gnu.org>
Sun, 19 Dec 2010 19:10:26 +0000 (19:10 +0000)
In libobjc/:
2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>

PR libobjc/47012
* accessors.m (objc_getProperty): If not atomic, do not
retain/autorelease the returned value. (Problem reported by

From-SVN: r168070

libobjc/ChangeLog
libobjc/accessors.m

index e9bfedb2d3c354b09a80c2bb8831287011d3fab3..55f35dc39892210ff3ab67db7401572ef95b2bc1 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       PR libobjc/47012
+       * accessors.m (objc_getProperty): If not atomic, do not
+       retain/autorelease the returned value. (Problem reported by
+
 2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objc-private/runtime.h (__objc_selector_max_index,
index d6469ea7ce50ef8f3564b87eafe5caf22bac8ecc..a47903a6c87bd31c8dca27307e8f91791371ec71 100644 (file)
@@ -106,8 +106,18 @@ objc_getProperty (id self, SEL __attribute__((unused)) _cmd, ptrdiff_t offset, B
     {
       id *pointer_to_ivar = (id *)((char *)self + offset);
 
+
       if (is_atomic == NO)
-       return AUTORELEASE (RETAIN (*pointer_to_ivar));
+       {
+         /* Note that in this case, we do not RETAIN/AUTORELEASE the
+            returned value.  The programmer should do it if it is
+            needed.  Since access is non-atomic, other threads can be
+            ignored and the caller has full control of what happens
+            to the object and whether it needs to be RETAINed or not,
+            so it makes sense to leave the decision to him/her.  This
+            is also what the Apple/NeXT runtime does.  */
+         return *pointer_to_ivar;
+       }
       else
        {
          objc_mutex_t lock = accessors_locks[ACCESSORS_HASH (pointer_to_ivar)];