- Code: Select all
destructor TThumbnailPreview.Destroy;
begin
LargeImages.Free; // <<==-- Add this line to prevent obscure resource leaks
FPaperViewOptions.Free;
Page.Free;
inherited Destroy;
end;
destructor TThumbnailPreview.Destroy;
begin
LargeImages.Free; // <<==-- Add this line to prevent obscure resource leaks
FPaperViewOptions.Free;
Page.Free;
inherited Destroy;
end;
constructor TThumbnailPreview.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if Assigned(AOwner) and (AOwner is TControl) then
FixControlStyles(TControl(AOwner));
FZoom := 10;
FSpacingHorizontal := 8;
FSpacingVertical := 8;
FMarkerColor := clBlue;
FPaperViewOptions := TPaperPreviewOptions.Create; // This object is not owned by component, so it should be freed implicitly in the destructor
FPaperViewOptions.OnChange := PaperViewOptionsChanged;
Page := TBitmap.Create; // This object is not owned by component too, so it should be freed implicitly
ParentColor := True;
ReadOnly := True;
ViewStyle := vsIcon;
LargeImages := TImageList.Create(Self); // "Self" is passed as owner, so "Self" is responsible for freeing the TImageList instance.
Align := alLeft;
end;
destructor TThumbnailPreview.Destroy;
begin
FPaperViewOptions.Free;
Page.Free;
inherited Destroy;
end;
Return to DELPHI AREA Projects
Users browsing this forum: No registered users and 42 guests