@@ -17,10 +17,11 @@ #include "config.h" #include #import "OFMutableDictionary.h" +#import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "macros.h" #define BUCKET struct of_dictionary_bucket #define DELETED &of_dictionary_deleted_bucket @@ -273,26 +274,32 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { + OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; size_t i; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { if (mutations != mutations2) @throw [OFEnumerationMutationException newWithClass: isa]; - if (data[i] != NULL && data[i] != DELETED) + if (data[i] != NULL && data[i] != DELETED) { block(data[i]->key, data[i]->object, &stop); + [pool releaseObjects]; + } } + + [pool release]; } - (void)replaceObjectsUsingBlock: (of_dictionary_replace_block_t)block { + OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; size_t i; BOOL stop = NO; unsigned long mutations2 = mutations; for (i = 0; i < size && !stop; i++) { @@ -309,10 +316,14 @@ selector: _cmd]; [new retain]; [data[i]->object release]; data[i]->object = new; + + [pool releaseObjects]; } } + + [pool release]; } #endif @end