PrintpreviewAction hangs on delphi 2009

General TRichView support forum. Please post your questions here
Post Reply
erikvdw
Posts: 40
Joined: Tue Feb 28, 2006 8:27 am

PrintpreviewAction hangs on delphi 2009

Post by erikvdw »

We use the trichviewactions v1.69 with richviewedit v11.02
We can print an dbgrid into a table by using datatext integration.
In D2006 it works nice, but in D2009 the applications hangs in previewaction. Small table are correct printed, larger tables hangs.
For example:
9 cols and 6 rows -> Problem
1 cols and 2 rows -> No problem
4 cols and 13 rows -> Problem
3 cols and 10 rows -> No problem
3 cols and 13 rows -> No Problem

Stepping hangs on:
PreviewForm := GetPreviewFormClass.Create(Application) as TfrmRVPreview;
in RichViewActions.pas
I have no idea where to search. I will try to make a small program to reproduce. Is there anyone else with this trouble?
Sergey Tkachenko
Site Admin
Posts: 17604
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I cannot reproduce this problem in the ActionTest demo.
May be a code executed before the action corrupts a memory?
erikvdw
Posts: 40
Joined: Tue Feb 28, 2006 8:27 am

clear tag

Post by erikvdw »

I found the problem (after a long search).

We use to insert autotext code:

Code: Select all

RVData.AddNLTag(Trim(lText) , lFontNew.Index, 0, Integer(StrNew(PChar(lDataTag)))
When a user open an document we replace the tags with the selected data. After replacing we remove the tag with the code:

Code: Select all

        lDataTag := PChar(aRVData.GetItem(lI));
        if (lDataTag<>EmptyStr) then
        begin // Item has a tag: replace text
          aRVData.GetItem(lI).Tag := 0;
          FreeMemory(PChar(lDataTag));
        end
The freememory of lDataTag is the trouble. Using StrDispose is not the solution. How to clean the memory which was allocated by StrNew?
Sergey Tkachenko
Site Admin
Posts: 17604
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Include rvoTagsArePChars in Options, and string tags will be freed automatically.
Post Reply