Allow the retain count to become 0.

With the new retain count scheme, it must reach 0 or double frees won't be
caught.
This commit is contained in:
Bill Currie 2012-11-20 14:41:13 +09:00
parent ef0f30935f
commit 951bed6206

View file

@ -292,10 +292,13 @@ BOOL (id object) object_is_meta_class = #0;
- (/*oneway*/ void) release
{
if ([self retainCount] == 1) // don't let retain count reach zero
int rc;
rc = obj_decrement_retaincount (self);
if (rc < 0)
obj_error (self, 0, "retain count went negative");
if (rc == 0)
[self dealloc];
else
obj_decrement_retaincount (self);
}
- (id) autorelease