@@ -347,35 +347,43 @@ } - (OFEnumerator*)objectEnumerator { return [[[OFListEnumerator alloc] - initWithFirstListObject: firstListObject - mutationsPointer: &mutations] autorelease]; + initWithList: self + mutationsPointer: &mutations] autorelease]; } @end @implementation OFListEnumerator -- initWithFirstListObject: (of_list_object_t*)first_ - mutationsPointer: (unsigned long*)mutationsPtr_; +- initWithList: (OFList*)list_ + mutationsPointer: (unsigned long*)mutationsPtr_; { self = [super init]; - first = first_; - current = first_; + list = [list_ retain]; + current = [list firstListObject]; mutations = *mutationsPtr_; mutationsPtr = mutationsPtr_; return self; } + +- (void)dealloc +{ + [list release]; + + [super dealloc]; +} - (id)nextObject { id ret; if (*mutationsPtr != mutations) - @throw [OFEnumerationMutationException newWithClass: isa]; + @throw [OFEnumerationMutationException newWithClass: isa + object: list]; if (current == NULL) return nil; ret = current->object; @@ -387,8 +395,8 @@ - (void)reset { if (*mutationsPtr != mutations) @throw [OFEnumerationMutationException newWithClass: isa]; - current = first; + current = [list firstListObject]; } @end