View Issue Details

IDProjectCategoryView StatusLast Update
0038774LazarusLCLpublic2021-04-19 02:55
Reporterlainz Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status newResolutionopen 
Platformx86OSWindows 
Product Version2.1 (SVN) 
Summary0038774: DefineProperties together with XMLConf causes memory leak
DescriptionDefining a binary property in a custom component, reading that binary stream with XMLConfig causes a memory leak.

I'm not sure where is the error, if in the DefineProperties or in the XMLConfig.

Heaptrc:
PROCESSRESOURCE, line 2080 of include/customform.inc
INITCOMPONENT, line 3153 or lresources.pp
INITLAZRESOURCECOMPONENT, line 3180 or lresources.pp
INITRESOURCECOMPONENT, line 798 or lresources.pp
PROCESSRESOURCE, line 2080 of include/customform.inc

Parts of the source:

procedure TBGRASVGImageList.DefineProperties(Filer: TFiler);
begin
  inherited DefineProperties(Filer);
  Filer.DefineBinaryProperty('Items', ReadData, WriteData, True);
end;

procedure TBGRASVGImageList.ReadData(Stream: TStream);
var
  FXMLConf: TXMLConfig;
begin
  FXMLConf := TXMLConfig.Create(Self);
  try
    Stream.Position := 0;
    FXMLConf.LoadFromStream(Stream); <---- ERROR
    Load(FXMLConf);
  finally
    FXMLConf.Free;
  end;
end;

Full source:
https://forum.lazarus.freepascal.org/index.php?topic=54216.msg402603;topicseen#new
Steps To ReproduceInstall bgrabitmap and bgracontrols, drop a TBGRASVGImageList, add an SVG image. Run the program, close the program. It crashes with Heaptrc information available.
TagsNo tags attached.
Fixed in Revision
LazTarget
WidgetsetWin32/Win64
Attached Files

Activities

lainz

2021-04-19 02:55

reporter   ~0130445

Hi, seems that's a memory leak with the XMLConfig itself, not other kind of error.

Issue History

Date Modified Username Field Change
2021-04-18 20:34 lainz New Issue
2021-04-19 02:55 lainz Note Added: 0130445