integrated-application-development / delphilint

Delphi IDE package providing on-the-fly code analysis and linting, powered by SonarDelphi
GNU Lesser General Public License v3.0
87 stars 13 forks source link

Intermittent access violation in `boreditu.dll` #6

Closed fourls closed 5 months ago

fourls commented 8 months ago

Prerequisites

DelphiLint version

0.7.0

SonarDelphi version

1.3.0

SonarQube version

No response

Issue description

After extended use, the IDE sometimes gets into a state that causes access violations when scrolling, hovering, or otherwise interacting with the central code editor.

This has been a longstanding issue and appears to be an IDE bug - it is caused by an access violation in the line tracker, which DelphiLint only provides with value types.

Examples

image

image

Stack trace

[681B7C65]{boreditu.dll} C:\PROJECTS\OLYMPUS\TP\INTERMEDIATE\DEBUG\LIB\UTF8\EK_ENTRY.OBJ.EK_GET_LINE_CONTENTS + $269
[6FB966D0]{rtl280.bpl  } System.DynArraySetLength (Line 36396, "System.pas" + 98) + $13
[6FB8A36C]{rtl280.bpl  } System.@GetMem (Line 4937, "System.pas" + 20) + $0
[6FB91FCA]{rtl280.bpl  } System.@NewUnicodeString (Line 25624, "System.pas" + 10) + $0
[6FB93677]{rtl280.bpl  } System.@UStrSetLength (Line 30912, "System.pas" + 74) + $0
[6FBD3A27]{rtl280.bpl  } System.SysUtils.StringReplace (Line 26236, "System.SysUtils.pas" + 195) + $3B
[6FB8A36C]{rtl280.bpl  } System.@GetMem (Line 4937, "System.pas" + 20) + $0
[6F2FD862]{coreide280.bpl} EdProcs.SafeEkEval (Line 374, "EdProcs.pas" + 4) + $8
[6F2FC0F4]{coreide280.bpl} EdKrnl.EkEval (Line 3576, "EdKrnl.pas" + 3) + $9
[6F2FA7D0]{coreide280.bpl} EdKrnl.DetachTrackTable (Line 1251, "EdKrnl.pas" + 7) + $4
[6F2FED31]{coreide280.bpl} EdTrackr.TEdTracker.Detach (Line 202, "EdTrackr.pas" + 2) + $A
[6F2FEFC2]{coreide280.bpl} EdTrackr.TEdTracker.SetCapacity (Line 310, "EdTrackr.pas" + 3) + $2
[6F2FEC37]{coreide280.bpl} EdTrackr.TEdTracker.AddPos (Line 169, "EdTrackr.pas" + 31) + $12
[6F328546]{coreide280.bpl} EditorBuffer.TOTAEditLineTracker.AddLine (Line 4675, "EditorBuffer.pas" + 3) + $5
[6248CCB4]{DelphiLintClient-0.1.0.bpl} Delphilint.Ide.TEditorLineTracker.TrackLine + $8
[6248DF91]{DelphiLintClient-0.1.0.bpl} Delphilint.Ide.TLintEditor.OnAnalysisComplete + $A9
[6248CECF]{DelphiLintClient-0.1.0.bpl} Delphilint.Ide.TEditorLineNotifier.LineChanged + $193
[6247E9DE]{DelphiLintClient-0.1.0.bpl} Delphilint.Events. + $4E
[62476315]{DelphiLintClient-0.1.0.bpl} Delphilint.Context.TLintContext.OnAnalyzeError + $2D9
[6FCA11E7]{rtl280.bpl  } System.Classes.CheckSynchronize (Line 15766, "System.Classes.pas" + 34) + $A
[6C0C2647]{fmx280.bpl  } FMX.Platform.Win.TPlatformWin.ThreadSync (Line 3486, "FMX.Platform.Win.pas" + 3) + $2
[6FCA580C]{rtl280.bpl  } System.Classes.StdWndProc (Line 18490, "System.Classes.pas" + 8) + $0
[71595883]{vclide280.bpl} IDEVirtualTrees.TVirtualTreeHintWindow.IsHintMsg (Line 7121, "IDEVirtualTrees.pas" + 7) + $13
[6EB9428F]{vcl280.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 11460, "Vcl.Forms.pas" + 23) + $1
[6EB942D2]{vcl280.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 11490, "Vcl.Forms.pas" + 1) + $4
[6EB94611]{vcl280.bpl  } Vcl.Forms.TApplication.Run (Line 11629, "Vcl.Forms.pas" + 27) + $3
[00788082]{bds.exe     } bds.bds (Line 227, "" + 16) + $2

Steps to reproduce

Unclear. Anecdotally, it does seem to require

Minimal Delphi code exhibiting the issue

No response

code-kungfu commented 8 months ago

I recall this being an issue in 11.3 when Embt introduced the advanced editor ToolsAPI interfaces. It happens deep inside the editor kernel and what I've gathered from debugging a similar issue for my own plugins where I'm tapping into the editor, the editor kernel loses focus of where it is, in its internal representation of the editor content.

fourls commented 8 months ago

Glad to hear confirmation that it isn't just a DelphiLint issue - it's really very frustrating since it's an exception that can't be caught. I assume you haven't found any workarounds, @code-kungfu?

fourls commented 5 months ago

I think this may be fixed in 1.1.0 by #32. I'll close this in a week or so if I hear no new reports.