AngelicTech / thtmlviewer

Automatically exported from code.google.com/p/thtmlviewer
Other
1 stars 1 forks source link

error when we use FullDisplaySize function #391

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which steps will reproduce the problem?
1. use demo BmpDemo included in project
2. open sample.html file
3. push button "make bitmaps"

What is the expected output?
having a bitmap of screen

What do you see instead?
there are an error "invalide pointer operation"
the error is when we use FullDisplaySize function

Which version of the product are you using? Which compiler version are you
using? On which operating system?

THMLVIEWER last revision 500
Delphi XE
windows 7

Original issue reported on code.google.com by bruno.pe...@gmail.com on 16 Jan 2015 at 3:03

Attachments:

GoogleCodeExporter commented 9 years ago
Complemented by a description of the problem. The error is not the only reason. 
The error occurs:

function THtmlViewer.FullDisplaySize(FormatWidth: Integer): TSize;
var
  Curs: Integer;
  CopyList: ThtDocument;
begin
  Result.cx := 0; {error return}
  Result.cy := 0;
  if FormatWidth > 0 then
  begin
    CopyList := ThtDocument.CreateCopy(FSectionList);
    try
      Curs := 0;
      Result.cy := CopyList.DoLogic(PaintPanel.Canvas, 0, FormatWidth, 300, 0, Result.cx, Curs);
    finally
      CopyList.Free;   <====
    end;
  end;
end;

If you comment out this line the error occurs:

destructor ThtDocument.Destroy;
begin
  inherited Destroy; // Yunqa.de: Destroy calls Clear, so do this first.   <====
  IDNameList.Free;
  htmlFormList.Free;
  MapList.Free;
  AGifList.Free;
  Timer.Free;
  FormControlList.Free;
  MissingImages.Free;
  LinkList.Free;
  PanelList.Free;
  Styles.Free;
  DrawList.Free;
  PositionList.Free;
  TabOrderList.Free;
  if not IsCopy then
    InlineList.Free;
  FPropStack.Free;
end;

Probably error can occur anywhere where there is a release after the creation 
of:

ThtDocument.CreateCopy(------);

But even if you comment out the line causing the error, the function creates a 
metafile MakeMetaFile with errors and distortions of the structure.

I beg to fix the problem, it is critical. :)

Original comment by SchwarzK...@yandex.ru on 21 Jan 2015 at 9:16

Attachments:

GoogleCodeExporter commented 9 years ago
I do not know for what purpose respected author introduced the function:

    procedure Add(var Section: TSection; TagIndex: Integer); overload;

But if you revert to the old version of the function:

     procedure Add (Item: TSectionBase; TagIndex: Integer);

r499 from all works fine and without errors. Although the new function 
logically identical.

The author will offer its own version fixes bugs, but now you can enjoy it. :)

Original comment by SchwarzK...@yandex.ru on 29 Jan 2015 at 8:14