bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMutableArray copyWithZone infinite loop with gc=yes


From: James Knight
Subject: NSMutableArray copyWithZone infinite loop with gc=yes
Date: Fri, 10 May 2002 04:24:21 -0400

Since, with gc=yes, RELEASE is a noop, the --i never gets executed. Thus, the loop is infinite. This seems to be the only place in the code where there is side a effect of a expression in RELEASE. However, it might be a good idea to have "#define RELEASE(object) ((id)object)" instead of "#define RELEASE(object)" to protect against future problems of this sort. The downside I can see to that is that there will be a bunch more "statement with no effect" warnings.

*** Source-orig/NSArray.m       Thu Mar 21 04:45:30 2002
--- Source/NSArray.m    Fri May 10 04:14:54 2002
***************
*** 990,997 ****
      objects[i] = [objects[i] copyWithZone: zone];
    newArray = [[GSArrayClass allocWithZone: zone]
      initWithObjects: objects count: count];
!   while (i > 0)
!     RELEASE(objects[--i]);
    return newArray;
  }

--- 990,997 ----
      objects[i] = [objects[i] copyWithZone: zone];
    newArray = [[GSArrayClass allocWithZone: zone]
      initWithObjects: objects count: count];
!   for (i = 0; i < count; i++)
!     RELEASE(objects[i]);
    return newArray;
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]