fxite: LexAccessor.h:136: void LexAccessor::ColourTo(unsigned int, int):
Assertion 'pos >= startSeg' failed.
I tried here on 2 different machines (ArchLinux and Ubuntu) but I wasn't
able to reproduce the crash, but he says it crashes for him on 4 different
Ubuntu systems. He mostly works with LaTeX files with Dutch keyboard and
locale, so maybe that has something to do with it. He also mentioned the
problem only happens with FXiTe/FXScintilla, but not with SciTE/GTK.
Since I had no clue where to begin debugging this, I told him to try commenting
out the assertion and re-compiling the editor. He reported back that solved the
problem, no more crashes and no problems with the lexer. The curious thing to
me is the statement immediately following the assertion:
assert(pos >= startSeg);
if (pos < startSeg) {
return;
}
which makes me wonder what the purpose of the assertion is anyway (other than
to cause a crash ;-)
Since I already do a minimal amount of patching when pulling in the latest
Scintilla sources, it wouldn't take much effort to patch out the assertion,
but I wonder if this might cause any unforeseen problems. I would also be
interested to know if anyone has any idea what might be causing the
assertion to fail.
Thanks,
-Jeff
> Since I had no clue where to begin debugging this, I told him to try commenting
> out the assertion and re-compiling the editor. He reported back that solved the
> problem, no more crashes and no problems with the lexer. The curious thing to
> me is the statement immediately following the assertion:
>
> assert(pos >= startSeg);
> if (pos < startSeg) {
> return;
> }
The assert is only active in debug builds so should not be seen by users.
You can't undo styling by moving backwards so trying is normally a
mistake and having the assert there can help debug lexer behaviour.
Neil
> The assert is only active in debug builds so should not be seen by users.
Ah, so that's it. I am using autotools to generate the Makefile so I added a
configure option to define -DNDEBUG, hopefully that will prevent "users" from
getting bitten by things like this.
> You can't undo styling by moving backwards so trying is normally a
> mistake and having the assert there can help debug lexer behaviour.
So it sounds like the assertion failure is more likely due to a problem
with LaTeX lexer itself, and not something in the Fox implementation?
Thanks,
- Jeff
> So it sounds like the assertion failure is more likely due to a problem
> with LaTeX lexer itself, and not something in the Fox implementation?
Yes, the assertion should help with finding bugs in lexers. It is
often triggered by unexpected character sequences such as comments
starting immediately after an operator.
Neil