@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -105,12 +105,10 @@ for (size_t i = 0; i < count; i++) { if ([objects[i] isEqual: oldObject]) { [newObject retain]; [objects[i] release]; objects[i] = newObject; - - return; } } } - (void)replaceObjectAtIndex: (size_t)idx withObject: (id)object @@ -164,18 +162,21 @@ objects = _array.items; count = _array.count; for (size_t i = 0; i < count; i++) { if ([objects[i] isEqual: object]) { - object = objects[i]; + id tmp = objects[i]; [_array removeItemAtIndex: i]; _mutations++; - [object release]; + [tmp release]; - return; + objects = _array.items; + i--; + count--; + continue; } } } - (void)removeObjectIdenticalTo: (id)object @@ -194,11 +195,14 @@ [_array removeItemAtIndex: i]; _mutations++; [object release]; - return; + objects = _array.items; + i--; + count--; + continue; } } } - (void)removeObjectAtIndex: (size_t)idx