Avoid potential crash when removing the last layout manager of a text

storage whose text network is owned by a text view.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31813 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2011-01-01 16:35:03 +00:00
parent 3b7e6aa708
commit 0245f84ad2
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2011-01-01 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSTextStorage.m (-removeLayoutManager:): Avoid potential
crash when text network is owned by a text view.
2010-12-31 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSToolbarView.m (initSystemExtensionsColors): Remove this

View file

@ -99,8 +99,13 @@ static NSNotificationCenter *nc = nil;
- (void) removeLayoutManager: (GSLayoutManager*)obj
{
/* If the receiver belongs to a text network that is owned by its text view
it could get deallocated by the call to -setTextStorage:. To prevent
crashes we retain the receiver until the end of this method. */
RETAIN(self);
[obj setTextStorage: nil];
[_layoutManagers removeObjectIdenticalTo: obj];
RELEASE(self);
}
- (NSArray*) layoutManagers