Browse Source

memory leak fix on delete layer

Johann 6 years ago
parent
commit
1927c9e527
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lazpaint/image/ustatetype.pas

+ 7 - 0
lazpaint/image/ustatetype.pas

@@ -208,6 +208,7 @@ type
     constructor Create(ALayeredImage: TBGRALayeredBitmap; AIndex: integer);
     constructor Create(ALayeredImage: TBGRALayeredBitmap; AIndex: integer);
     constructor Create(ALayeredImage: TBGRALayeredBitmap; AIndex: integer;
     constructor Create(ALayeredImage: TBGRALayeredBitmap; AIndex: integer;
                        AAlwaysStoreBitmap: boolean);
                        AAlwaysStoreBitmap: boolean);
+    destructor Destroy; override;
     procedure Restore(ALayeredImage: TBGRALayeredBitmap);
     procedure Restore(ALayeredImage: TBGRALayeredBitmap);
     procedure Replace(ALayeredImage: TBGRALayeredBitmap);
     procedure Replace(ALayeredImage: TBGRALayeredBitmap);
     property LayerIndex: integer read FIndex;
     property LayerIndex: integer read FIndex;
@@ -1070,6 +1071,12 @@ begin
   end;
   end;
 end;
 end;
 
 
+destructor TStoredLayer.Destroy;
+begin
+  FOriginalData.Free;
+  inherited Destroy;
+end;
+
 procedure TStoredLayer.Restore(ALayeredImage: TBGRALayeredBitmap);
 procedure TStoredLayer.Restore(ALayeredImage: TBGRALayeredBitmap);
 var
 var
   tempIdx, idxOrig: Integer;
   tempIdx, idxOrig: Integer;