Attempted fix for multiple dealloc problems.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14855 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-10-28 08:08:57 +00:00
parent 90645a5f8a
commit 63ed41067f
2 changed files with 19 additions and 9 deletions

View file

@ -1,3 +1,9 @@
2002-10-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSTextField.m: ([-dealloc]) morph self to be an NSTextView
so that when dealloc is re-called, any subclass dealloc methods
don't get re-called.
2002-10-27 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
* Source/NSMenuView.m ([NSMenuView -trackWithEvent:]):

View file

@ -358,17 +358,21 @@ static NSNotificationCenter *nc;
{
if (_textStorage != nil)
{
/* This releases all the text objects (us included) which means
* this method will be called again ... so this time we just return.
/*
* Destroying our _textStorage releases all the text objects
* (us included) which means this method will be called again ...
* so this time round we should just return, and the rest of
* the deallocation can be done on the next call to dealloc.
*
* However, the dealloc methods of any subclasses should
* already have been called before this method is called,
* and those subclasses don't know how to cope with being
* deallocated more than once ... to deal with that we
* set the isa pointer so that the subclass dealloc methods
* won't get called again.
*/
isa = [NSTextView class];
DESTROY (_textStorage);
/* When the rest of the text network is released, we'll be
* released again and be deallocated for real. That will
* likely happen during the DESTROY of the _textStorage, or
* later if parts of the text network are maybe retained
* elsewhere (in autorelease pools etc) for slightly longer.
*/
return;
}
}