Thema: Delphi GraphicEx und P(E)NG!

Einzelnen Beitrag anzeigen

Benutzerbild von Gausi
Gausi

Registriert seit: 17. Jul 2005
900 Beiträge
 
Delphi 11 Alexandria
 
#2

Re: GraphicEx und P(E)NG!

  Alt 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.
  Mit Zitat antworten Zitat