Registriert seit: 17. Jul 2005
900 Beiträge
Delphi 11 Alexandria
|
Re: GraphicEx und P(E)NG!
1. Feb 2009, 12:13
Die Methode hat da ein Memoryleak. Wenn man was googelt, findet man die Lösung:
Füge in der Methode TPNGGraphic.LoadFromStream(Stream: TStream); ungefähr in Zeile 6985 ein FreeMem(FRawBuffer); ein - unmittelbar vor FRawBuffer := nil;
Delphi-Quellcode:
// ...
FPalette := 0;
FTransparency := nil;
FBackgroundColor := clWhite;
FTransparentColor := clNone;
// first chunk must be an IHDR chunk
FCurrentCRC := LoadAndSwapHeader;
!!!! FreeMem(FRawBuffer);
FRawBuffer := nil;
ColorManager.SourceOptions := [coNeedByteSwap];
try
// read IHDR chunk
ReadDataAndCheckCRC;
Move(FRawBuffer^, Description, SizeOf(Description));
// ...
Being smart will count for nothing if you don't make the world better. You have to use your smarts to count for something, to serve life, not death.
|