View Issue Details

IDProjectCategoryView StatusLast Update
0036192LazarusIDEpublic2021-03-13 20:36
ReporterA Rasm Assigned ToMichl  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWindows 
Product Version2.0.4 
Fixed in Version2.1 (SVN) 
Summary0036192: IDE crashes when auto-scrollbars in a Memo are selected (containing large body of text)
DescriptionThe attached project contains a memo with (quite a bit) of text.

If you select

    Object inspector > Memo > Scrollsbars > ssAutoBoth

the IDE produces the following message:

   "Failed to create win32 control, error 2147943568 : Element not found"
Steps To Reproduce(See attached project for specific memo contents)

1. Create new project
2. Create memo
(3. Select wordwrap = false)
4. fill memo lines with text
5. Select "scrollbars" "ssAutoBoth"

IDE crashes with error message.

TagsNo tags attached.
Fixed in Revision64796
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

A Rasm

2019-10-16 22:35

reporter  

project_bug.zip (156,451 bytes)

jamie philbrook

2019-10-16 23:11

reporter   ~0118637

Last edited: 2019-10-16 23:13

View 2 revisions

Ok, so I did all the steps you specified, filled the memo with lots of garbage using the OI string editor..

 Set the scroll feature as specified and it works here in both the 32 and 64 bit of 2.0.4?

One note I wish to add, you shouldn't be able to load up the Memo like that from resource, it puts a strain on the system.

A Rasm

2019-10-17 18:15

reporter   ~0118644

Last edited: 2019-10-17 21:26

View 2 revisions

Strange.
I reproduced on a different Windows 7 machine.

Did a minimal install of lazarus-2.0.4-fpc-3.0.4-win64.exe on a fresh Windows 7 home edition machine. Language Danish .

New lazarus project ( saved it to a new folder ), created the memo, disabled wordwrap,
Entered Lines TString property.
Copy/pasted the entire/exact contents of the attached textfile

  badmemo.zip

 (from Windows notepad) 6600 lines into the memo. Pressed ok to close the dialog.

Set memo scrollbars to auto,

Triggers Win32 exception in lazarus.exe ( a slightly different error # on that machine, so maybe some sort of memory corruption )


regards,

badmemo.zip (6,888 bytes)

A Rasm

2019-10-17 18:26

reporter   ~0118646

The result appears identical using a project with just a button and an empty memo.


procedure TForm1.Button1Click(Sender: TObject);
begin
    Memo1.Lines.LoadFromFile('badmemo.txt');
    Memo1.ScrollBars:=ssAutoBoth;
end;


(where badmemo.txt is the attached 622kb file)

Bart Broersma

2019-10-17 18:55

developer   ~0118647

On Win10, Lazarus 2.1 32-bit loading a 645.120 bytes textfile (360K time 'A') in a TMemo completely freezes the application.
This is even before setting the scrollbars to ssAutoBoth (from ssNone to begin with).
No error or exception dialog.
No such problem with a TSynEdit.

A Rasm

2019-10-17 21:23

reporter   ~0118648

re: Bart Broersma, loading 360K x 'A'
-----------------------------------
(I think mine can load the large textfile, even though it takes in the order of minutes), it eventually finishes.


As for the other exception w. ssAuto-scroll:
----------------------------------------
When I single-step the ssAuto line,

the exception eventually (after quite a few operations) happens here:

===========8<======unit Win32WSControls===============================================

177 procedure FinishCreateWindow(const AWinControl: TWinControl; var Params: TCreateWindowExParams;
  . const AlternateCreateWindow: boolean; SubClass: Boolean = False);
  .
  ..(snip)...
  .
212 Window := CreateWindowExW(FlagsEx, PWideChar(WideString(pClassName)),
  . PWideChar(UTF8ToUTF16(WindowTitle)), Flags,
  . Left, Top, Width, Height, Parent, 0, HInstance, @NCCreateParams);
  .
216 if Window = 0 then
  . begin
  . AErrorCode := GetLastError;
  . DebugLn(['Failed to create win32 control, error: ', AErrorCode, ' : ', GetLastErrorText(AErrorCode)]);
220 raise Exception.Create('Failed to create win32 control, error: ' + IntToStr(AErrorCode) + ' : ' + GetLastErrorText(AErrorCode));
  . end;
  . end;
======================================

Some of the values of the parameters (as per mouse-over) to CreateWindowExW are :

 FlagsEx=512
 pClassname='Edit'
 WindowTitle <------------------ appears to contain (all?) the Memo lines
 Flags=1176571972
 Parent=263500

(don't know the relevant ones)

Bart Broersma

2019-10-17 21:53

developer   ~0118649

> (I think mine can load the large textfile, even though it takes in the order of minutes), it eventually finishes.
Yes, indeed it does finish: about 5 minutes ....
No error on the scrollbars though.

Vladimir Slavik

2021-01-30 18:52

reporter   ~0128680

Last edited: 2021-01-30 18:59

View 3 revisions

I believe I'm seeing this in 2.0.10 (r63526) on 32-bit Windows 7. I have a form with memos that have ssAutoBoth set in form designer, and they are filled with a lot of text (json dump from youtube-dl, quite a few kB).

Changing the scrollbars to only ssBoth does not fix the problem. Changing to ssNone does not fix the problem, either. Curiously, I can't reproduce the problem in my situation reliably. The data, components, screen position,... are the same, but sometimes it survives most of the time, so I have to repeat the action to get the crash. I estimate 1 in 5-40 cases actually error out for me. (The variable factor influencing the survival rate is the text, of course.)

Not sure if that is useful.

Juha Manninen

2021-01-30 19:58

developer   ~0128685

> Not sure if that is useful.

Vladimir Slavik, you should build Lazarus trunk (development version) and its libraries (LazUtils, LCL) with all debug flags enabled.
Then build your own application with debug flags, too.
Then you may get meaningful exception messages. The best would be to run your app under debugger. It gives a proper backtrace after a crash.
A debugger backtrace would be very useful here.

Michl

2021-03-13 20:36

developer   ~0129636

Fixed in Trunk revision 64796. Please test and close if ok.

Note:
https://stackoverflow.com/questions/35135543/what-is-the-maximum-length-of-a-window-title-passed-to-setwindowtext
There is no defined max length for a window title on Windows. Even 100.000 characters are working. 1.200.000 like in the example are to much, there is raised a range check error - the reason for IDE crash. IMHO even 256 characters would be enough, I use MaxWord as maximal length for a window title.

Issue History

Date Modified Username Field Change
2019-10-16 22:35 A Rasm New Issue
2019-10-16 22:35 A Rasm File Added: project_bug.zip
2019-10-16 23:11 jamie philbrook Note Added: 0118637
2019-10-16 23:13 jamie philbrook Note Edited: 0118637 View Revisions
2019-10-17 18:15 A Rasm File Added: badmemo.zip
2019-10-17 18:15 A Rasm Note Added: 0118644
2019-10-17 18:26 A Rasm Note Added: 0118646
2019-10-17 18:55 Bart Broersma Note Added: 0118647
2019-10-17 21:23 A Rasm Note Added: 0118648
2019-10-17 21:26 A Rasm Note Edited: 0118644 View Revisions
2019-10-17 21:53 Bart Broersma Note Added: 0118649
2021-01-30 18:52 Vladimir Slavik Note Added: 0128680
2021-01-30 18:58 Vladimir Slavik Note Edited: 0128680 View Revisions
2021-01-30 18:59 Vladimir Slavik Note Edited: 0128680 View Revisions
2021-01-30 19:58 Juha Manninen Note Added: 0128685
2021-03-13 20:26 Michl Assigned To => Michl
2021-03-13 20:26 Michl Status new => assigned
2021-03-13 20:36 Michl Status assigned => resolved
2021-03-13 20:36 Michl Resolution open => fixed
2021-03-13 20:36 Michl Fixed in Version => 2.1 (SVN)
2021-03-13 20:36 Michl Fixed in Revision => 64796
2021-03-13 20:36 Michl LazTarget => -
2021-03-13 20:36 Michl Widgetset Win32/Win64 => Win32/Win64
2021-03-13 20:36 Michl Note Added: 0129636