@@ -470,19 +470,18 @@ i < last && _buckets[i] != NULL; i++) { if (_buckets[i] == &deletedBucket) continue; if (_keyFunctions.equal(_buckets[i]->key, key)) { - _mutations++; - _keyFunctions.release(_buckets[i]->key); _objectFunctions.release(_buckets[i]->object); OFFreeMemory(_buckets[i]); _buckets[i] = &deletedBucket; _count--; + _mutations++; resizeForCount(self, _count); return; } } @@ -616,16 +615,16 @@ { bool stop = false; unsigned long mutations = _mutations; for (size_t i = 0; i < _capacity && !stop; i++) { + if (_buckets[i] != NULL && _buckets[i] != &deletedBucket) + block(_buckets[i]->key, _buckets[i]->object, &stop); + if (_mutations != mutations) @throw [OFEnumerationMutationException exceptionWithObject: self]; - - if (_buckets[i] != NULL && _buckets[i] != &deletedBucket) - block(_buckets[i]->key, _buckets[i]->object, &stop); } } - (void)replaceObjectsUsingBlock: (OFMapTableReplaceBlock)block {