@@ -46,11 +46,11 @@ #endif if (last == nil) { @try { [[self alloc] init]; - } @catch (OFException *e) { + } @catch (id e) { [obj release]; @throw e; } #ifdef OF_THREADS @@ -63,11 +63,11 @@ @throw [OFInitializationFailedException newWithClass: self]; } @try { [last addObject: obj]; - } @catch (OFException *e) { + } @catch (id e) { [obj release]; @throw e; } } @@ -80,55 +80,45 @@ #endif } - init { -#ifdef OF_THREADS - id first; -#endif - self = [super init]; -#ifdef OF_THREADS - first = of_tlskey_get(first_key); - prev = of_tlskey_get(last_key); - - if (!of_tlskey_set(last_key, self)) { - Class c = isa; - [super dealloc]; - @throw [OFInitializationFailedException newWithClass: c]; - } -#else - prev = last; - last = self; -#endif - - if (first == nil) { -#ifdef OF_THREADS - if (!of_tlskey_set(first_key, self)) { - Class c = isa; - - of_tlskey_set(last_key, prev); - - [super dealloc]; - @throw [OFInitializationFailedException - newWithClass: c]; - } -#else - first = self; -#endif - } - - if (prev != nil) - prev->next = self; - - size = GROW_SIZE; - @try { + @try { +#ifdef OF_THREADS + id first = of_tlskey_get(first_key); + prev = of_tlskey_get(last_key); + + if (!of_tlskey_set(last_key, self)) + @throw [OFInitializationFailedException + newWithClass: isa]; +#else + prev = last; + last = self; +#endif + + if (first == nil) { +#ifdef OF_THREADS + if (!of_tlskey_set(first_key, self)) { + of_tlskey_set(last_key, prev); + @throw [OFInitializationFailedException + newWithClass: isa]; + } +#else + first = self; +#endif + } + + if (prev != nil) + prev->next = self; + + size = GROW_SIZE; objects = [self allocMemoryForNItems: GROW_SIZE withSize: sizeof(id)]; - } @catch (OFException *e) { - [self dealloc]; + } @catch (id e) { + [self release]; @throw e; } return self; }