ObjFW  Diff

Differences From Artifact [2fd942db62]:

To Artifact [bd25c897fc]:


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
	if (self != [OFAutoreleasePool class])
		return;

	pool_list_key = [[OFTLSKey alloc] initWithDestructor: release_list];
}

+ (void)addToPool: (OFObject*)obj
{
	OFList *pool_list = [OFThread objectForTLSKey: pool_list_key];

	if (pool_list == nil || [pool_list last] == NULL) {
		@try {
			[[self alloc] init];
			pool_list = [OFThread objectForTLSKey: pool_list_key];
		} @catch (OFException *e) {
			[obj release];
			@throw e;
		}
	}

	if (pool_list == nil || [pool_list last] == NULL) {
		[obj release];
		@throw [OFInitializationFailedException newWithClass: self];
	}

	@try {
		[[pool_list last]->object addToPool: obj];
	} @catch (OFException *e) {
		[obj release];
		@throw e;
	}
}

- init







|



















|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
	if (self != [OFAutoreleasePool class])
		return;

	pool_list_key = [[OFTLSKey alloc] initWithDestructor: release_list];
}

+ (void)addObjectToTopmostPool: (OFObject*)obj
{
	OFList *pool_list = [OFThread objectForTLSKey: pool_list_key];

	if (pool_list == nil || [pool_list last] == NULL) {
		@try {
			[[self alloc] init];
			pool_list = [OFThread objectForTLSKey: pool_list_key];
		} @catch (OFException *e) {
			[obj release];
			@throw e;
		}
	}

	if (pool_list == nil || [pool_list last] == NULL) {
		[obj release];
		@throw [OFInitializationFailedException newWithClass: self];
	}

	@try {
		[[pool_list last]->object addObject: obj];
	} @catch (OFException *e) {
		[obj release];
		@throw e;
	}
}

- init
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
	[self releaseObjects];

	[[OFThread objectForTLSKey: pool_list_key] remove: listobj];

	[super dealloc];
}

- addToPool: (OFObject*)obj
{
	if (objects == nil)
		objects = [[OFMutableArray alloc] init];

	[objects add: obj];
	[obj release];

	return self;
}

- (void)release
{







|




|







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
	[self releaseObjects];

	[[OFThread objectForTLSKey: pool_list_key] remove: listobj];

	[super dealloc];
}

- addObject: (OFObject*)obj
{
	if (objects == nil)
		objects = [[OFMutableArray alloc] init];

	[objects addObject: obj];
	[obj release];

	return self;
}

- (void)release
{