#704 Hidelines(0,0) crashes scintilla

Bug
open-accepted
Neil Hodgson
Scintilla (791)
3
2008-08-03
2008-07-28
Anonymous
No

very simple to reproduce:

just create a scintilla window, enter a few lines of text (at least one line). If Hidelines(lineNr,lineNr) is called, it behaves normally except for lineNr=0 which crashes the app.

I am using a 1.75

I don't understand how something so big has not been already corrected. This is quite an annoying bug...

Ludovic Aubert at ludo.aubert@gmail.com

Discussion

  • Neil Hodgson
    Neil Hodgson
    2008-08-03

    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-accepted
     
  • Neil Hodgson
    Neil Hodgson
    2008-08-03

    Logged In: YES
    user_id=12579
    Originator: NO

    The main use of hiding lines is for folding where the initial line is always visible. Several parts of the code assume an initial visible line. While a fix would be worthwhile, I won't be working on this myself. I have added a note to the documentation saying that the first line can not be hidden and the code now does nothing if called with a zero lineStart.

     
  • Hello Neil,

    I have found out why this happened. In debug mode only, there is an assertion that GetVisible() is true, and in there, there is a confusion if the lineNumber is 0 (change a <=0 to a <0 or something like that. To reproduce, call HideLines(0,0) in debug mode, it will crash on an assertion and you will see that an operator < or > must be changed in case lineNumber = 0. it is basic but if I must be more precise, send me an e-mail at ludo.aubert@gmail.com

    regard
    Ludovic

     
  • Neil Hodgson
    Neil Hodgson
    2008-09-13

    The assertion is there to give early warning of a situation that will cause trouble for other code. Simply removing the assertion will only cover up the problem a little.