mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 13:30:54 +00:00
Prevent potential crashes due to invalid pointers left in text
containers and layout managers when their respective layout manager and text storage are deallocated. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35178 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d69b1eed65
commit
514393b9d6
3 changed files with 13 additions and 0 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2012-06-05 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/GSLayoutManager.m (-dealloc): Set layout manager of every
|
||||||
|
text container to nil to avoid dangling pointer in case the text
|
||||||
|
container is retained elsewhere.
|
||||||
|
|
||||||
|
* Source/NSTextStorage.m (-dealloc): Set text storage of every
|
||||||
|
layout manager to nil to avoid dangling pointer in case the layout
|
||||||
|
manager is retained elsewhere.
|
||||||
|
|
||||||
2012-06-03 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2012-06-03 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Source/NSTextView.m (-performUndo): Update text storage directly
|
* Source/NSTextView.m (-performUndo): Update text storage directly
|
||||||
|
|
|
@ -2918,6 +2918,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
||||||
[self _freeLayout];
|
[self _freeLayout];
|
||||||
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
|
for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++)
|
||||||
{
|
{
|
||||||
|
[tc->textContainer setLayoutManager: nil];
|
||||||
[tc->textContainer release];
|
[tc->textContainer release];
|
||||||
}
|
}
|
||||||
free(textcontainers);
|
free(textcontainers);
|
||||||
|
|
|
@ -61,6 +61,8 @@ static NSNotificationCenter *nc = nil;
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[self setDelegate: nil];
|
[self setDelegate: nil];
|
||||||
|
[_layoutManagers makeObjectsPerformSelector: @selector(setTextStorage:)
|
||||||
|
withObject: nil];
|
||||||
RELEASE (_layoutManagers);
|
RELEASE (_layoutManagers);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue