ObjFW  Check-in [4f4f619d84]

Overview
Comment:Also release pools that are on top of the pool being released.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4f4f619d848a4835f56b37568e46b88a8da9d9174e760b0b7f06f9434219dfa3
User & Date: js on 2009-05-13 17:58:50
Other Links: manifest | tags
Context
2009-05-13
19:39
Get rid of a @try block in OFString. check-in: 1c798ffa3f user: js tags: trunk
17:58
Also release pools that are on top of the pool being released. check-in: 4f4f619d84 user: js tags: trunk
2009-05-07
16:08
Add OFSocket base class. check-in: 0110aec5c0 user: js tags: trunk
Changes

Modified src/OFAutoreleasePool.m from [0e0d5e7d64] to [82173abc64].

85
86
87
88
89
90
91









92
93
94
95
96
97
98
	listobj = [pool_list append: self];

	return self;
}

- free
{









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

	return [super free];
}

- addToPool: (OFObject*)obj
{







>
>
>
>
>
>
>
>
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
	listobj = [pool_list append: self];

	return self;
}

- free
{
	/*
	 * 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];

	return [super free];
}

- addToPool: (OFObject*)obj
{
118
119
120
121
122
123
124














125
		return self;

	[objects release];
	objects = nil;

	return self;
}














@end







>
>
>
>
>
>
>
>
>
>
>
>
>
>

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
		return self;

	[objects release];
	objects = nil;

	return self;
}

- retain
{
	// FIXME: Maybe another exception would be better here?
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

- autorelease
{
	// FIXME: Maybe another exception would be better here?
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}
@end

Modified tests/OFAutoreleasePool/OFAutoreleasePool.m from [aa69694177] to [558bb07388].

93
94
95
96
97
98
99
100
101
102
103
104
105
106
	[pool1 releaseObjects];

	o2 = [[[OFObject alloc] init] autorelease];

	pool2 = [[OFAutoreleasePool alloc] init];
	o3 = [[[OFObject alloc] init] autorelease];

	[pool1 retain];
	[pool1 release];
	[pool1 release];
	[o3 free];

	return (inits == 20 && retains == 6 && releases == 13 ? 0 : 1);
}







<

<
<

|

93
94
95
96
97
98
99

100


101
102
103
	[pool1 releaseObjects];

	o2 = [[[OFObject alloc] init] autorelease];

	pool2 = [[OFAutoreleasePool alloc] init];
	o3 = [[[OFObject alloc] init] autorelease];


	[pool1 release];



	return (inits == 20 && retains == 5 && releases == 16 ? 0 : 1);
}