Menu

#2481 Crash inside Editor::Paint()

Bug
closed-fixed
5
2025-06-08
2025-05-27
Zufu Liu
No

I have got a crash inside Editor::Paint() on the line if (!marginView.pixmapSelPattern->Initialised()), where marginView.pixmapSelPattern is nullptr (due to ChangeSize() been called).

Rough call trace (missing quote for multiline string, which cause code folding for all subsequence lines changed):

Paint 000001EF1FBA1B00
Paint marginView 000001EF1FBA1B00
Paint 000001EF1FBA1B00
Paint marginView 000001EF1FBA1B00
FoldExpand
SetScrollBars
Paint 000001EF1FBA1B00
FoldExpand
SetScrollBars
ChangeSize
DropGraphics
SetScrollBars
FoldChanged
SetScrollBars
FoldChanged
... // many repeated FoldChanged / SetScrollBars
FoldChanged
SetScrollBars
FoldChanged
SetScrollBars
Paint marginView 0000000000000000

The crash could be fixed with either:

  1. Add extra check: if (!marginView.pixmapSelPattern || !marginView.pixmapSelPattern->Initialised()).
  2. Just remove all preceding RefreshPixMaps(surfaceWindow); and add one before the if block (so only a single call). I don't understand why RefreshPixMaps() needs to be called earlier in the function.

Discussion

  • Neil Hodgson

    Neil Hodgson - 2025-05-28
    1. OK. [7915af]
     

    Related

    Commit: [7915af]

  • Zufu Liu

    Zufu Liu - 2025-05-28
    • status: open --> open-fixed
     
  • Zufu Liu

    Zufu Liu - 2025-05-28

    The crash is due to styling inside StyleAreaBounded().

    Paint before StyleAreaBounded 00000223964009A0
    StyleAreaBounded scrolling=0, area=5723, max=5723
    StyleToPositionInView pos=5723, endWindow=5723, endStyled=295
    FoldChanged 18
    FoldExpand 18, expanding=1
    FoldExpand 85 SetScrollBars
    SetScrollBars
    ChangeSize
    DropGraphics
    SetScrollBars
    FoldChanged 19
    FoldChanged 19 SetVisible
    SetScrollBars
    FoldChanged 20
    FoldChanged 20 SetVisible
    ...
    FoldChanged 214
    FoldChanged 215
    FoldChanged 216
    Paint after StyleAreaBounded 0000000000000000
    WrapLines(1) lineToWrap=0, lineToWrapEnd=54
    WrapLines(1) wrapOccurred=0
    Paint marginView Initialised 0000000000000000
    

    styling inside WrapLines(WrapScope::wsVisible) may also cause code folding/scrollbar changes that may (?) not be observed by wrapOccurred, so move down RefreshPixMaps(surfaceWindow); looks is the proper fix.

     
  • Neil Hodgson

    Neil Hodgson - 2025-06-08
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB