TScaleRichView: Program crash with Lazarus

General TRichView support forum. Please post your questions here
Post Reply
luc
Posts: 13
Joined: Wed Jan 12, 2022 9:20 am

TScaleRichView: Program crash with Lazarus

Post by luc »

Hi,
I started to use TRichView and TScaleRichView with Lazarus2.2.0 (rev lazarus_2_2_0) FPC 3.2.2 x86_64-win64-win32/win64,

Installation was fine but unfortunately Demo ActionTestUni crashes every time I tried to import a somewhat basic *.docx file.
The same file is correctly imported in the compiled Demo (compiled with Delphi I guess) available on TRichView website.

I tried to export the file from the working Demo (The delphi one) to different formats and then import them to the Lazarus Demo: *.rtf and even *.rvf import fails with a crash. Drag/Drop of the file on a blank doc does'nt crash but the output/preview is not correctly formated (and you must remove à é è.. chars from your file name).

The basic readme.rvf is working...

I can send the *.doc - *.rtf - *.rvf via pm if needed.

Thanks
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TScaleRichView: Program crash with Lazarus

Post by Sergey Tkachenko »

I can reproduce the problem with opening DocX files in ScaleRichView in Lazarus 2.2.
I'll fix it as soon as possible.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TScaleRichView: Program crash with Lazarus

Post by Sergey Tkachenko »

I found the bug with DocX loading. It happens when loading a file containing a lot of images. This is a serious bug that affects both Lazarus and Delphim any file format; it was introduced in the last update (the demos on the web site were not recompiled, what's why they do not have it). I'll upload an update in the next couple of days.
Meanwhile I sent a fixed unit to you by email.

I also confirm the second problem with à é è.. chars in file names of dropped files. This is a Lazarus-specific bug, its fix will be included in the next update too, let me know if you need this fix urgently.

What do you mean by "output/preview is not correctly formated", can you provide more details in email?
luc
Posts: 13
Joined: Wed Jan 12, 2022 9:20 am

Re: TScaleRichView: Program crash with Lazarus

Post by luc »

Thanks for your fast support,
I applied the patched *.pas, no more crash on the first file load but I still have problems when loading a file (same file) several times, using: menu/file open. The document layout is not correctly displayed the second time (appears to be the same problem as the one with dropped file).
You should be able to reproduce the problem with the first *.docx file I sent you.

I still have a crash with the original *.docx file when loaded twice or more. I was not able to find the problem yet but it seems related to TObjectList out of bounds the second time I try to load the file in the demo. I will send you a screenshot and the *.docx by mail.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TScaleRichView: Program crash with Lazarus

Post by Sergey Tkachenko »

I already fixed the problem with resetting to default margins (it was Lazarus-specific).
I can reproduce the problem with the second document, I am working on it.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TScaleRichView: Program crash with Lazarus

Post by Sergey Tkachenko »

Must be fixed in TRichView 20.0.1 (just uploaded)
luc
Posts: 13
Joined: Wed Jan 12, 2022 9:20 am

Re: TScaleRichView: Program crash with Lazarus

Post by luc »

Thanks for the fix,
I installed the v11.0.2
Indeed, the problem is solved with the original *.docx file but SRV is still crashing with the same file exported as *.rvf or *.rtf with: index(-1) out of bounds message.
I was not able to locate the error in the source code since the lazarus debugger doesn't stop on the line, even with debugging info on + cleanup all + rebuild.
I will send you the files by private mail and let me know if/how I can help
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TScaleRichView: Program crash with Lazarus

Post by Sergey Tkachenko »

It seems that all these crashes are specific to Lazarus 2.2.
The problem happens when loading RTF and RVF because (unlike DocX) they call OnProgress event, and the demo uses this event to display a progress bar. In Lazarus 2.2, manipulations with a progress bar leads to calling resizing of other controls on the form, and ScaleRichView (of SRVPageScroll) does not expect repainting in the middle of loading.

As for loading images from DocX in headers and footers, I confirm the problem.

I'll provide fixes till the end of this week.

Sergey
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TScaleRichView: Program crash with Lazarus

Post by Sergey Tkachenko »

Must be fixed in the today's update
Post Reply