[Lazarus] Res leaks on exiting gtk2 app

Alexey aaa5500 at ya.ru
Tue Jun 27 00:02:37 CEST 2017


On 27.06.2017 00:22, Mattias Gaertner via Lazarus wrote:
>   it must be something you
> are doing with the imagelist.
> You must give some clues what you are doing otherwise no one can help.

I'm doing loading of png files [Imagelist size 16x] to it--


function UpdateImagelistWithIconFromFile(AImagelist: TCustomImagelist;
   const AFilename: string): boolean;
var
   bmp: TCustomBitmap;
begin
   Result:= false;
   if AImagelist=nil then exit;
   if not FileExistsUtf8(AFilename) then exit;

   if ExtractFileExt(AFilename)='.bmp' then
     bmp:= TBitmap.Create
   else
   if ExtractFileExt(AFilename)='.png' then
     bmp:= TPortableNetworkGraphic.Create
   else
     exit;

   try
     try
       bmp.LoadFromFile(AFilename);
       bmp.Transparent:= true;
       AImagelist.Add(bmp, nil);
       Result:= true;
     finally
       FreeAndNil(bmp);
     end;
   except
   end;
end;

for many icons.

-- 
Regards,
Alexey



More information about the Lazarus mailing list