Hello,
I'm trying to create a program who need lot of pictures (I load more than 1 042 PNG's at start). I don't know why but after a massive load I have a access violation after a random time.
I think this can be a LCL bug because the bug is when I move my mouse in my main form. Stranger I have created and show a form before my massive load, and he work perfectly !
My function to load bitmaps is
function LoadPicture(const FileName:TFilename):TBitmap;
begin
Result := TBitmap.Create;
LoadPicture(FileName,Result);
end;
procedure LoadPicture(const FileName:TFilename;const Bitmap:TBitmap);
begin
// LoadPicturePicture := TPicture.Create;
InternalLogger.Info('Begin LoadPicture from "%s"',[FileName]);
try
LoadPicturePicture.LoadFromFile(FileName);
Bitmap.SetSize(LoadPicturePicture.Width,LoadPicturePicture.Height);
Bitmap.Canvas.Draw(0,0,LoadPicturePicture.Graphic);
except
on E:Exception do
begin
InternalLogger.Error('End LoadPicture fail ! [%s] %s',[E.ClassName,E.Message]);
raise;
end;
end;
InternalLogger.Info('End LoadPicture');
// LoadPicturePicture.Free;
end;
I load pictures in a FormCreate and I store them into a array.
I have two times this bug and this make me
. Have you a answer ?
ps:Sorry if my english is bad...