|
From: | address@hidden |
Subject: | Re: ProjectCenter Editor parenthesis highlighting segfault |
Date: | Wed, 27 Aug 2014 18:48:59 +0200 |
Hello,
i thought that accessing an array out of it's dimension would lead to a segfault in the header of the loop.
But reading your last mails I compiled the code with the original _expression_ in the head of the for-loop
and put NSLog(@"---i=%i---",i) right at the beginning of the body.
- (void)unhighlightCharacter: (NSTextView *)editorView
{
int i;
NSTextStorage *textStorage = [editorView textStorage];
[textStorage beginEditing];
// if (isCharacterHighlit)
for (i = 0; (highlited_chars[i] != -1 && i < 2); i++)
{
NSLog(@"---i=%i---",i);
NSRange r = NSMakeRange(highlited_chars[i], 1);
// NSRange r = NSMakeRange(highlitCharacterLocation, i);
...
output of PC when clicking on a parenthesis:
openapp ProjectCenter
2014-08-27 18:37:08.045 ProjectCenter[9823] final candidate path is: /usr/local/bin/gmake
2014-08-27 18:37:08.046 ProjectCenter[9823] final candidate path is: /usr/bin/gmake
2014-08-27 18:37:08.046 ProjectCenter[9823] final candidate path is: /usr/local/bin/make
2014-08-27 18:37:08.046 ProjectCenter[9823] final candidate path is: /usr/bin/make
2014-08-27 18:37:08.046 ProjectCenter[9823] Build tool found: /usr/bin/make
2014-08-27 18:37:08.064 ProjectCenter[9823] final candidate path is: /usr/local/bin/gdb
2014-08-27 18:37:08.064 ProjectCenter[9823] final candidate path is: /usr/bin/gdb
2014-08-27 18:37:08.065 ProjectCenter[9823] Debugger tool found: /usr/bin/gdb
2014-08-27 18:37:08.129 ProjectCenter[9823] NSDocumentClass PCProjectDocument not found
2014-08-27 18:37:08.130 ProjectCenter[9823] NSDocumentClass PCProjectDocument not found
2014-08-27 18:37:08.130 ProjectCenter[9823] NSDocumentClass PCClassDocument not found
2014-08-27 18:37:08.130 ProjectCenter[9823] NSDocumentClass PCHeaderDocument not found
2014-08-27 18:37:08.130 ProjectCenter[9823] NSDocumentClass PCCDocument not found
2014-08-27 18:37:12.496 ProjectCenter[9823] [click] category: Classes forProject: TestPCColors fileName: (null)
2014-08-27 18:37:13.066 ProjectCenter[9823] [click] category: Classes forProject: TestPCColors fileName: AppController.m
2014-08-27 18:37:13.066 ProjectCenter[9823] [click] category: Classes filePath: /Classes/AppController.m/
2014-08-27 18:37:13.067 ProjectCenter[9823] Opening new editor. Editor: ProjectCenter
2014-08-27 18:37:13.073 ProjectCenter[9823] PCProjectEditor editorDidOpen!
2014-08-27 18:37:13.165 ProjectCenter[9823] PCPE: categoryPath - /Classes/AppController.m/
2014-08-27 18:37:13.165 ProjectCenter[9823] PCEditor: asked for browser items for: AppController.m
2014-08-27 18:37:13.166 ProjectCenter[9823] Class> {ClassBodyRange = "{location=193, length=988}"; ClassName = "@AppController"; ClassNameRange = "{location=179, length=13}"; }
2014-08-27 18:37:13.354 ProjectCenter[9823] ClassHandler: dealloc
2014-08-27 18:37:14.579 ProjectCenter[9823] ---i=0---
2014-08-27 18:37:14.580 ProjectCenter[9823] ---i=1---
2014-08-27 18:37:14.580 ProjectCenter[9823] ---i=2---
2014-08-27 18:37:14.580 ProjectCenter[9823] ---i=3---
Speicherzugriffsfehler (Speicherabzug geschrieben)
I expected that i could never get greater than 1 in the body of the loop as the boolean _expression_
must return false when i reaches 2. I ran this several times and i always reaches 3 bevor the segfault
occurs.
Markus
[Prev in Thread] | Current Thread | [Next in Thread] |