Make sure the text storage doesn't have unprocessed editing when using it.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16378 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-04-06 13:12:34 +00:00
parent 5448a979d5
commit c6beeb60ec
2 changed files with 37 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2003-04-06 15:10 Alexander Malmberg <alexander@malmberg.org>
* Source/GSLayoutManager.m (-_generateGlyphsUpToCharacter:): Make
sure that all editing of the text storage has been processed before
trying to generate glyhps for it.
2003-04-05 12:58 Alexander Malmberg <alexander@malmberg.org>
* Source/NSFontPanel.m (-_initWithoutGModel): Make preview active

View file

@ -51,6 +51,20 @@ static int random_level(void)
}
/*
Private method used internally by GSLayoutManager for sanity checking.
*/
@interface NSTextStorage (GSLayoutManager_sanity_checking)
-(unsigned int) _editCount;
@end
@implementation NSTextStorage (GSLayoutManager_sanity_checking)
-(unsigned int) _editCount;
{
return _editCount;
}
@end
/***** Glyph handling *****/
@implementation GSLayoutManager (glyphs_helpers)
@ -560,6 +574,23 @@ static glyph_run_t *run_insert(glyph_run_head_t **context)
int length;
BOOL dummy;
/*
Trying to do anything here while the text storage has unprocessed edits
(ie. an edit count>0) breaks things badly, and in strange ways. Thus, we
detect this and raise an exception.
*/
if ([_textStorage _editCount])
{
[NSException raise: NSGenericException
format: @"Glyph generation was triggered for a layout manager "
@"while the text storage it was attached to had "
@"unprocessed editing. This is not allowed. Glyph "
@"generation may be triggered only at points where "
@"calls to -beginEditing and -endEditing are "
@"balanced."];
}
if (!_textStorage)
return;
length = [_textStorage length];