ObjFW  Check-in [344d7506df]

Overview
Comment:Improve handling of failed init in OFTLSKey.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 344d7506df84cac2daed5a62a074300e1e22259c9a9f38e833851bd5a9a7fdfb
User & Date: js on 2009-11-15 02:10:10
Other Links: manifest | tags
Context
2009-11-15
14:25
Get rid of 3 more FIXMEs. check-in: 51833ec7a7 user: js tags: trunk
02:10
Improve handling of failed init in OFTLSKey. check-in: 344d7506df user: js tags: trunk
01:39
Improve OFFile and add a few new exceptions. check-in: 5cb7f93a1f user: js tags: trunk
Changes

Modified src/OFThread.m from [ae7f24832c] to [12445a3521].

151
152
153
154
155
156
157





158
159
160
161
162
163
164

	destructor = NULL;

	@synchronized (tlskeys) {
		@try {
			listobj = [tlskeys append: self];
		} @catch (OFException *e) {





			listobj = NULL;
			[self dealloc];
			@throw e;
		}
	}

	return self;







>
>
>
>
>







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

	destructor = NULL;

	@synchronized (tlskeys) {
		@try {
			listobj = [tlskeys append: self];
		} @catch (OFException *e) {
			/*
			 * We can't use [super dealloc] on OS X here.
			 * Compiler bug? Anyway, [self dealloc] will do here
			 * as we check listobj != NULL in dealloc.
			 */
			listobj = NULL;
			[self dealloc];
			@throw e;
		}
	}

	return self;
177
178
179
180
181
182
183


184
185
186
187
188
189
190
191
{
	if (destructor != NULL)
		destructor(self);

	of_tlskey_free(key);

	@synchronized (tlskeys) {


		[tlskeys remove: listobj];
	}

	[super dealloc];
}
@end

@implementation OFMutex







>
>
|







182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
{
	if (destructor != NULL)
		destructor(self);

	of_tlskey_free(key);

	@synchronized (tlskeys) {
		/* In case we called [self dealloc] in init */
		if (listobj != NULL)
			[tlskeys remove: listobj];
	}

	[super dealloc];
}
@end

@implementation OFMutex