I'm trying to track down the cause of a crash in Komodo when you repeatedly draw an indicator around the same words in the document. If I avoid calling ll->EndLineStyle from various points in Editor.cxx when ll->maxLineLength == 0 I don't crash immediately. If I leave the code as is, I can crash immediately.
The function is in the new "Multiple Selection: Add Next Occurrence of Current Word to Set"
which lets you change several instances of text in the document to a new value in parallel.
The default keybinding is "Ctrl-D", and if you keep pressing Ctrl-D when you hit the end
of the document, Komodo wraps to the beginning and re-applies the decoration to the
same pieces of text it saw before.
Unfortunately, that's not enough. Even with my "safeGetSpaceWidth", Komodo sometimes
will crash under Windows if I create these indicators quickly enough (and they're always
re-created at the same positions). I also needed to avoid redrawing existing identifiers,
and then I can hit Ctrl-D repeatedly, without crashing.
I can't say if the bug is completely in Scintilla. The "safeGetSpaceWidth" method, which
returns 0 if ll->maxLineLength == 0, avoids an obvious stacktrace, but I saw three other
stacktraces in the debugger on crashing, none of which involved scintilla. It could be that
a notification from drawing an indicator triggered other code, but it's hard to see
any kind of memory corruption (For the record, the three stacktraces involve
involving a generic XUL routine).
In sum, avoiding calling LineLayout::EndLineStyle when self->maxLineLength == 0,
and avoiding redrawing existing indicators, prevents the crash.
And this only happens on Windows -- I can't reproduce on Linux or OSX. Which leads
me to believe there's a weird kind of memory corruption problem going on here.
Log in to post a comment.