ObjFW  Check-in [af41efe079]

Overview
Comment:Two small fixes for OFAutoreleasePool.

First, when an OFAutoreleasePool is deallocated, it should always
release all the objects.

Second, releaseObject should also release the objects of the pools on
top of the current pool.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: af41efe079b0456193f87526cef4b6ec471701a389945d0c4ae1ef690a07a639
User & Date: js on 2009-05-14 13:46:00
Other Links: manifest | tags
Context
2009-05-14
14:24
Get rid of OFNotInSetException. check-in: bdc9b3219f user: js tags: trunk
13:46
Two small fixes for OFAutoreleasePool. check-in: af41efe079 user: js tags: trunk
2009-05-13
20:39
Let - release return void again. check-in: 6d589825cd user: js tags: trunk
Changes

Modified src/OFAutoreleasePool.m from [99c26c51d9] to [1d59e36e29].

91
92
93
94
95
96
97


98
99
100
101
102
103
104
	 * FIXME:
	 * Maybe we should get the objects ourself, release them and then
	 * release the pool without calling its release method? This way,
	 * there wouldn't be a recursion.
	 */
	if (listobj->next != NULL)
		[listobj->next->object release];



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

	[super dealloc];
}

- addToPool: (OFObject*)obj







>
>







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	 * FIXME:
	 * Maybe we should get the objects ourself, release them and then
	 * release the pool without calling its release method? This way,
	 * there wouldn't be a recursion.
	 */
	if (listobj->next != NULL)
		[listobj->next->object release];

	[self releaseObjects];

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

	[super dealloc];
}

- addToPool: (OFObject*)obj
116
117
118
119
120
121
122



123
124
125
126
127
128
129
{
	[self releaseObjects];
	[super release];
}

- releaseObjects
{



	if (objects == nil)
		return self;

	[objects release];
	objects = nil;

	return self;







>
>
>







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
	[self releaseObjects];
	[super release];
}

- releaseObjects
{
	if (listobj->next != NULL)
		[listobj->next->object releaseObjects];

	if (objects == nil)
		return self;

	[objects release];
	objects = nil;

	return self;