mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix NSPointerArray so that it cleans up its array on dealloc. This is needed
to avoid memory leaks with strong references and heap corruption with weak ones. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35878 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
69d4344a0a
commit
1c2ce264aa
1 changed files with 7 additions and 0 deletions
|
@ -335,6 +335,13 @@ static Class concreteClass = Nil;
|
|||
- (void) dealloc
|
||||
{
|
||||
[self finalize];
|
||||
// For weak memory, we must zero all of the elements, or the runtime will
|
||||
// keep pointers to them lying around. For strong memory, we must release
|
||||
// things or they will leak.
|
||||
for (int i=0 ; i<_count ; i++)
|
||||
{
|
||||
pointerFunctionsAssign(&_pf, &_contents[i], 0);
|
||||
}
|
||||
if (_contents != 0)
|
||||
{
|
||||
NSZoneFree([self zone], _contents);
|
||||
|
|
Loading…
Reference in a new issue