Fixed dealloc so that it can dealloc a layout manager which has not been

-init


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12484 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-02-11 02:42:12 +00:00
parent 8e7bfb06a7
commit 90f3074971

View file

@ -585,7 +585,9 @@ _Sane(NSLayoutManager *lm)
*/ */
- (id) init - (id) init
{ {
if ([super init] != nil) self = [super init];
if (self != nil)
{ {
GSIArray a; GSIArray a;
@ -621,23 +623,33 @@ _Sane(NSLayoutManager *lm)
{ {
unsigned i; unsigned i;
/* /* We check that the _glyphData and _glyphGaps are not NULL so that
* Release all glyph chunk information * we can dealloc an object which has not been -init (some
* regression tests need it).
*/ */
i = GSIArrayCount(glyphChunks);
while (i-- > 0) /*
* Release all glyph chunk information.
*/
if (_glyphData != NULL)
{ {
GSGlyphChunk *chunk; i = GSIArrayCount(glyphChunks);
while (i-- > 0)
{
GSGlyphChunk *chunk;
chunk = (GSGlyphChunk*)(GSIArrayItemAtIndex(glyphChunks, i).ptr); chunk = (GSGlyphChunk*)(GSIArrayItemAtIndex(glyphChunks, i).ptr);
GSDestroyGlyphChunk(chunk); GSDestroyGlyphChunk(chunk);
}
GSIArrayEmpty(glyphChunks);
NSZoneFree(NSDefaultMallocZone(), _glyphData);
} }
GSIArrayEmpty(glyphChunks);
NSZoneFree(NSDefaultMallocZone(), _glyphData);
_glyphData = 0;
GSIArrayEmpty((GSIArray)_glyphGaps); if (_glyphGaps != NULL)
NSZoneFree(NSDefaultMallocZone(), _glyphGaps); {
GSIArrayEmpty((GSIArray)_glyphGaps);
NSZoneFree(NSDefaultMallocZone(), _glyphGaps);
}
RELEASE (_textContainers); RELEASE (_textContainers);