hramenko / thtmlviewer

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

Resource leak in TMapArea #362

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which steps will reproduce the problem?

1. Load a web page with an image map

When loading a web page that includes an image with an area map, the viewer 
creates a list of map items, and each of these items create a Windows region. 
This Windows region is never deleted and can lead to an out-of-resources 
runtime error. 

Creation of the region in the unit HTMLUn2.pas:

   Area.FRegion := CreateRectRgnIndirect(Rect);

FRegion does not get deleted when TMapArea is freed.

Suggested change: add a constructor and destructor to the TMapArea class in 
HTMLUn2.pas

constructor TMapArea.Create;
begin
  FRegion := 0;
end;

destructor TMapArea.Destroy;
begin
  if FRegion <> 0 then
    DeleteObject(FRegion);
  inherited;
end;

Original issue reported on code.google.com by alexande...@ec-software.com on 24 Jun 2014 at 5:50

GoogleCodeExporter commented 9 years ago
Thanks for spotting this issue.

It is now fixed in the upcoming version 11.5 
(https://github.com/BerndGabriel/HtmlViewer/tree/HtmlViewer-11.4-to-11.5).

Original comment by OrphanCat on 25 Jun 2014 at 9:09