Page 1 of 1

PrintpreviewAction hangs on delphi 2009

Posted: Tue Jan 13, 2009 8:34 am
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?

Posted: Wed Jan 14, 2009 5:38 pm
by Sergey Tkachenko
I cannot reproduce this problem in the ActionTest demo.
May be a code executed before the action corrupts a memory?

clear tag

Posted: Mon Jan 19, 2009 12:30 pm
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?

Posted: Mon Jan 19, 2009 4:07 pm
by Sergey Tkachenko
Include rvoTagsArePChars in Options, and string tags will be freed automatically.