View Issue Details

IDProjectCategoryView StatusLast Update
0032972LazarusIDEpublic2018-09-05 12:54
Reporterregs Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Summary0032972: Crash when calling Identifier completion in interface section
DescriptionCrash when calling Identifier completion while typing function parameters in interface section
Steps To Reproduceunit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs;

type
  TForm1 = class(TForm)
  private

  public
    function f(f<ctrl+space> - access violation
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

end.
TagsNo tags attached.
Fixed in Revisionr58535, r58536
LazTarget-
Widgetset
Attached Files

Relationships

related to 0033054 resolvedMartin Friebe Patches Autoinvoke Identifier Completion on type 

Activities

Juha Manninen

2018-01-08 18:25

developer   ~0105495

Yes, confirmed. It happens always when the function's name and parameter are the same, even if they are longer than 1 character.
For example:
 function ab(ab

The exception happens in function TPascalParserTool.ReadParamList,
line 1513 which is:
  RaiseCharExpectedButAtomFound(20170421195425,':');

Somehow the function name messes with parsing the parameters. It is difficult to debug because the function is called all the time.
This is a crash bug, target will be 1.8.2.

Martin Friebe

2018-07-15 22:53

manager   ~0109502

The problem:

Codetool raises (several) exceptions (ECodeToolErro / describing why parsing failed "expecting ; but found ...")

At least on falls through to TApplication.HandleException, which wants to open a prompt dialog.

And somehow, during this prompt dialog, the paint event for the completion drop down is executed. (Actually ok, paints must still happen)
And this makes further calls to codetools, which fail again.

This calls TApplication.HandleException again, and that leads to lcl\include\application.inc line 1234
    HaltingProgram:=true;
    Halt;

----------
1) The first error in codetool, should probably cancel the exception window.
2) The paint event, should probably have an exception handler, and not fall back to TApplication.HandleException

3) Not sure if the ECodeToolError should go to TApplication.HandleException

----------
The trace of the last/nested exception in paint:

#0 RAISEEXCEPTIONFMT(0x2d4b0160, 20170421195425, 0x11249ac 'expected %s, but %s found', 0xe8fead8, 1, true) at customcodetool.pas:408
0000001 RAISECHAREXPECTEDBUTATOMFOUND(0x2d4b0160, 20170421195425, 58 ':') at pascalparsertool.pas:5306
0000002 READPARAMLIST(0x2d4b0160, false, true, 4223792) at pascalparsertool.pas:1538
0000003 EXTRACTPROCHEAD(0x2d4b0160, 0x2d4ef788, 4223792) at pascalreadertool.pas:752
0000004 PAINTCOMPLETIONITEM(0x118e2a4 'Dummy', 0x2ca3cdb0, 106, 1, 320, true, 0, 0x2c959068, CTIDENTCOMPLETION, 0x2a546690, 0xe8fed80, false) at sourceeditprocs.pas:608
0000005 ONSYNCOMPLETIONPAINTITEM(0x2c959068, 0x118e2a4 'Dummy', 0x2ca3cdb0, 1, 1, true, 0) at sourceeditor.pp:2629
0000006 PAINT(0x2d590f50) at syncompletion.pas:983
0000007 PAINTWINDOW(0x2d590f50, 1526799264) at include\customform.inc:1123
0000008 PAINTHANDLER(0x2d590f50, {MSG = 15, DC = 1526799264, PAINTSTRUCT = 0xe8ff1fc, RESULT = 0}) at include\wincontrol.inc:4864
0000009 WMPAINT(0x2d590f50, {MSG = 15, DC = 1526799264, PAINTSTRUCT = 0xe8ff1fc, RESULT = 0}) at include\wincontrol.inc:6843
0000010 WMPAINT(0x2d590f50, {MSG = 15, DC = 1526799264, PAINTSTRUCT = 0xe8ff1fc, RESULT = 0}) at include\customcontrol.inc:98
0000011 DISPATCH(0x2d590f50, 0) at ..\inc\objpas.inc:602
0000012 WNDPROC(0x2d590f50, {MSG = 15, WPARAM = 1526799264, LPARAM = 244314620, RESULT = 0, WPARAMLO = 7072, WPARAMHI = 23297, WPARAMFILLER = {}, LPARAMLO = 61948, LPARAMHI = 3727, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at include\control.inc:2238
0000013 WNDPROC(0x2d590f50, {MSG = 15, WPARAM = 1526799264, LPARAM = 244314620, RESULT = 0, WPARAMLO = 7072, WPARAMHI = 23297, WPARAMFILLER = {}, LPARAMLO = 61948, LPARAMHI = 3727, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at include\wincontrol.inc:5425
0000014 WNDPROC(0x2d590f50, {MSG = 15, WPARAM = 1526799264, LPARAM = 244314620, RESULT = 0, WPARAMLO = 7072, WPARAMHI = 23297, WPARAMFILLER = {}, LPARAMLO = 61948, LPARAMHI = 3727, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at include\customform.inc:1477
0000015 DELIVERMESSAGE(0x2d590f50, 0) at lclmessageglue.pas:112
0000016 SENDPAINTMESSAGE(0x2d5cdaa8, 0) at win32\win32callback.inc:710
0000017 DOWINDOWPROC(0x2d5cdaa8) at win32\win32callback.inc:2294
0000018 WINDOWPROC(12847134, 15, 0, 0) at win32\win32callback.inc:2699
0000019 CUSTOMFORMWNDPROC(12847134, 15, 0, 0) at win32\win32wsforms.pp:387
0000020 USER32!AddClipboardFormatListener at :0
0000021 USER32!EndTask at :0
0000022 WIN32WSFORMS_$$_ADJUSTFORMBOUNDS$TCUSTOMFORM$TRECT at :0
0000023 USER32!EndTask at :0
0000024 ?? at :0
0000025 USER32!CallNextHookEx at :0
0000026 USER32!IsWindow at :0
0000027 ntdll!KiUserCallbackDispatcher at :0
0000028 ?? at :0
0000029 USER32!DispatchMessageW at :0
0000030 USER32!EndTask at :0
0000031 ?? at :0
0000032 USER32!EndTask at :0
0000033 ?? at :0
0000034 USER32!DialogBoxIndirectParamAorW at :0
0000035 USER32!DialogBoxIndirectParamW at :0
0000036 DSA_GetSize at :0
0000037 ImageList_SetOverlayImage at :0
0000038 TaskDialogIndirect at :0
0000039 PROMPTUSER(0x109e22b0, 0x2bab1954 'Lazarus IDE v1.9.0 - proj'..., 0x30246f5c 'expected :, but end found'..., 257, 0xe8ff834, 2, 0, 2) at win32\win32lclintf.inc:773
0000040 PROMPTUSER(0x2bab1954 'Lazarus IDE v1.9.0 - proj'..., 0x30246f5c 'expected :, but end found'..., 257, 0xe8ff834, 2, 0, 2) at include\lclintf.inc:376
0000041 PROMPTUSER(0x2bab1954 'Lazarus IDE v1.9.0 - proj'..., 0x30246f5c 'expected :, but end found'..., 257, 0xe8ff834, 1, 0, 2) at include\lclintf.inc:535
0000042 SHOWEXCEPTION(0x10992718, 0x30558770) at include\application.inc:1591
0000043 HANDLEAPPLICATIONEXCEPTION(0x0, 0x0, 0x30558770) at lclexceptionstacktrace.pas:28
0000044 HANDLEEXCEPTION(0x10992718, 0x0) at include\application.inc:1258
0000045 DELIVERMESSAGE(0x2d1dfb38, 0) at lclmessageglue.pas:116
0000046 DOWINDOWPROC(0x2d5b7348) at win32\win32callback.inc:2537
0000047 WINDOWPROC(19269830, 256, 32, 3735553) at win32\win32callback.inc:2699
0000048 USER32!AddClipboardFormatListener at :0
0000049 USER32!EndTask at :0
0000050 WIN32INT$_$TWINDOWPROCHELPER_$__$$_DOWINDOWPROC$$LONGINT at :0
0000051 USER32!EndTask at :0
0000052 ?? at :0
#53 USER32!DispatchMessageW at :0
#54 USER32!DispatchMessageW at :0
0000055 APPPROCESSMESSAGES(0x109e22b0) at win32\win32object.inc:407
0000056 HANDLEMESSAGE(0x10992718) at include\application.inc:1282
0000057 RUNLOOP(0x10992718) at include\application.inc:1419
0000058 APPRUN(0x109e22b0, {Proc = {procedure (POINTER)} 0xe8ffedc, Self = 0x10992718}) at include\interfacebase.inc:54
0000059 RUN(0x10992718) at include\application.inc:1407
0000060 main at lazarus.pp:153

Martin Friebe

2018-07-15 23:08

manager   ~0109504

Here is the trace of the first error, after code tool finished, syncompletion is invoked (still in keydown). It tries to measure the items, before opening its drop down form. During measuring codetool throws an error.
And this does not get caught.

#0 fpc_raiseexception(0x2f9ddaa0, 0xa92f01, 0x2d22fee0) at ..\inc\except.inc:181
0000001 RAISEEXCEPTIONINSTANCE(0x2d22fee0, 0x2f9ddaa0, true) at customcodetool.pas:2465
0000002 RAISEEXCEPTIONCLASS(0x2d22fee0, 20170421195425, 0x2f8f9dec 'expected :, but end found', 0x11f8528, true) at customcodetool.pas:2476
0000003 RAISEEXCEPTION(0x2d22fee0, 20170421195425, 0x2f8f9dec 'expected :, but end found', true) at customcodetool.pas:401
0000004 RAISEEXCEPTIONFMT(0x2d22fee0, 20170421195425, 0x11249ac 'expected %s, but %s found', 0xe8ff1b4, 1, true) at customcodetool.pas:407
0000005 RAISECHAREXPECTEDBUTATOMFOUND(0x2d22fee0, 20170421195425, 58 ':') at pascalparsertool.pas:5306
0000006 READPARAMLIST(0x2d22fee0, false, true, 4223792) at pascalparsertool.pas:1538
0000007 EXTRACTPROCHEAD(0x2d22fee0, 0x2d269af8, 4223792) at pascalreadertool.pas:752
0000008 PAINTCOMPLETIONITEM(0x118e2a4 'Dummy', 0x2c9fcb98, 96, 0, 2540, true, 0, 0x2c9693e8, CTIDENTCOMPLETION, 0x0, 0x0, true) at sourceeditprocs.pas:608
0000009 ONSYNCOMPLETIONMEASUREITEM(0x2c9693e8, 0x118e2a4 'Dummy', 0x2c9fcb98, true, 0) at sourceeditor.pp:2659
0000010 CALCHINTRECT(0x2d291a40, 2560, 0x118e2a4 'Dummy', 0x0) at syncompletion.pas:2229
0000011 SHOWITEMHINT(0x2d290ca0, 0) at syncompletion.pas:736
0000012 SETPOSITION(0x2d290ca0, 0) at syncompletion.pas:1362
0000013 EXECUTE(0x2c9693e8, 0x2d2d7384 'f', 1031, 502) at syncompletion.pas:1482
0000014 EXECUTE(0x2c9693e8, 0x2d2d7384 'f', {LEFT = 1031, TOP = 485, RIGHT = 1039, BOTTOM = 502, TOPLEFT = {X = 1031, Y = 485}, BOTTOMRIGHT = {X = 1039, Y = 502}, VECTOR = {1031, 485, 1039, 502}}) at syncompletion.pas:1508
0000015 STARTIDENTCOMPLETIONBOX(0x2c968428, true, true) at sourceeditor.pp:5235
0000016 PROCESSUSERCOMMAND(0x2c968428, 0x2cf98510, 1103, '', 0x0) at sourceeditor.pp:4085
0000017 DOONPROCESSCOMMAND(0x2cf98510, 1103, '', 0x0) at synedit.pp:7216
0000018 COMMANDPROCESSOR(0x2cf98510, 1103, '', 0x0, 0) at synedit.pp:6562
0000019 KEYDOWN(0x2cf98510, 0, 4) at synedit.pp:2967
0000020 KEYDOWNBEFOREINTERFACE(0x2cf98510, 0, 4) at include\wincontrol.inc:5698
0000021 DOKEYDOWNBEFOREINTERFACE(0x2cf98510, {MSG = 48384, CHARCODE = 0, UNUSED = 0, KEYDATA = 3735553, RESULT = 0}, false) at include\wincontrol.inc:5829
0000022 CNKEYDOWN(0x2cf98510, {MSG = 48384, CHARCODE = 0, UNUSED = 0, KEYDATA = 3735553, RESULT = 0}) at include\wincontrol.inc:7220
0000023 DISPATCH(0x2cf98510, 0) at ..\inc\objpas.inc:602
0000024 WNDPROC(0x2cf98510, {MSG = 48384, WPARAM = 0, LPARAM = 3735553, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 1, LPARAMHI = 57, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at include\control.inc:2243
0000025 WNDPROC(0x2cf98510, {MSG = 48384, WPARAM = 0, LPARAM = 3735553, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 1, LPARAMHI = 57, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at include\wincontrol.inc:5425
0000026 WNDPROC(0x2cf98510, {MSG = 48384, WPARAM = 0, LPARAM = 3735553, RESULT = 0, WPARAMLO = 0, WPARAMHI = 0, WPARAMFILLER = {}, LPARAMLO = 1, LPARAMHI = 57, LPARAMFILLER = {}, RESULTLO = 0, RESULTHI = 0, RESULTFILLER = {}}) at synedit.pp:6143
0000027 DELIVERMESSAGE(0x2cf98510, 0) at lclmessageglue.pas:112
0000028 DOWINDOWPROC(0x2d2fa9f0) at win32\win32callback.inc:2537
0000029 WINDOWPROC(28969214, 256, 32, 3735553) at win32\win32callback.inc:2699
0000030 USER32!AddClipboardFormatListener at :0
0000031 USER32!EndTask at :0
0000032 WIN32INT$_$TWINDOWPROCHELPER_$__$$_DOWINDOWPROC$$LONGINT at :0
0000033 USER32!EndTask at :0
0000034 ?? at :0
0000035 USER32!DispatchMessageW at :0
0000036 USER32!DispatchMessageW at :0
0000037 APPPROCESSMESSAGES(0x109e22b0) at win32\win32object.inc:407
0000038 HANDLEMESSAGE(0x10992718) at include\application.inc:1282
0000039 RUNLOOP(0x10992718) at include\application.inc:1419
0000040 APPRUN(0x109e22b0, {Proc = {procedure (POINTER)} 0xe8ffedc, Self = 0x10992718}) at include\interfacebase.inc:54
0000041 RUN(0x10992718) at include\application.inc:1407
0000042 main at lazarus.pp:153

Martin Friebe

2018-07-15 23:13

manager   ~0109505

In 58535 I added a partial workaround.
It catches and ignores the error in the paint event.

Of course it is not a good idea to ignore the error. But at least the IDE no longer crashes.

In addition to the ignored errors, there is still another exception that makes it to TApplication.HandleException

Juha Manninen

2018-09-05 12:54

developer   ~0110512

I removed the target because Martin's workaround prevents a crash.
The bug itself remains although fixing it is not urgent. A function's name mysteriously messes with parsing its parameters.

Issue History

Date Modified Username Field Change
2018-01-07 17:03 regs New Issue
2018-01-08 18:25 Juha Manninen LazTarget => -
2018-01-08 18:25 Juha Manninen Note Added: 0105495
2018-01-08 18:25 Juha Manninen Status new => confirmed
2018-01-08 18:26 Juha Manninen LazTarget - => 1.8.2
2018-01-08 18:26 Juha Manninen Target Version => 1.8.2
2018-01-20 06:02 Ondrej Pokorny Relationship added related to 0033054
2018-01-21 09:58 Ondrej Pokorny Summary Crash when calling code completion in interface section => Crash when calling Identifier completion in interface section
2018-01-21 09:58 Ondrej Pokorny Description Updated View Revisions
2018-07-15 22:53 Martin Friebe Note Added: 0109502
2018-07-15 23:08 Martin Friebe Note Added: 0109504
2018-07-15 23:13 Martin Friebe Note Added: 0109505
2018-07-16 00:24 Mattias Gaertner Assigned To => Mattias Gaertner
2018-07-16 00:24 Mattias Gaertner Status confirmed => assigned
2018-09-05 12:17 Juha Manninen LazTarget 1.8.2 => 1.10
2018-09-05 12:17 Juha Manninen Target Version 1.8.2 => 1.10
2018-09-05 12:54 Juha Manninen Fixed in Revision => r58535, r58536
2018-09-05 12:54 Juha Manninen LazTarget 1.10 => -
2018-09-05 12:54 Juha Manninen Note Added: 0110512
2018-09-05 12:54 Juha Manninen Target Version 1.10 =>