The line cache in page mode can be allocated 0 non-caret line entries if the widget isn't allocated any visible space, which can happen when dragging a divider with scintilla in one of its children. Scintilla can crash with a divide by zero error when this happens. The patch simply checks for this and returns a non-cache line layout if needed.

John
? length-check.diff
Index: src/Editor.cxx
===================================================================
RCS file: /home/cvs/src/ide/external/scintilla/src/Editor.cxx,v
retrieving revision 1.18
diff -u -p -r1.18 Editor.cxx
--- src/Editor.cxx      25 Jan 2006 06:21:07 -0000      1.18
+++ src/Editor.cxx      10 Mar 2006 21:39:53 -0000
@@ -283,7 +283,7 @@ LineLayout *LineLayoutCache::Retrieve(in
        } else if (level == llcPage) {
                if (lineNumber == lineCaret) {
                        pos = 0;
-               } else {
+               } else if ( length > 1 ) {
                        pos = 1 + (lineNumber % (length - 1));
                }
        } else if (level == llcDocument) {
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to