fpvectorial: As per tips from Marcou Gilles, fixes VectorialPage.Clear which after the last commit wrongly freed the temp helper path

git-svn-id: trunk@37275 -
This commit is contained in:
sekelsenmat 2012-05-14 13:34:17 +00:00
parent 6f67bce681
commit 5ac1a1fe66

View File

@ -182,6 +182,7 @@ type
public public
X, Y, Z: Double; X, Y, Z: Double;
constructor Create; virtual; constructor Create; virtual;
procedure Clear; virtual;
// in CalculateBoundingBox always remember to treat correctly the case of ADest=nil!!! // in CalculateBoundingBox always remember to treat correctly the case of ADest=nil!!!
// This cased is utilized to guess the size of a document even before getting a canvas to draw at // This cased is utilized to guess the size of a document even before getting a canvas to draw at
procedure CalculateBoundingBox(ADest: TFPCustomCanvas; var ALeft, ATop, ARight, ABottom: Double); virtual; procedure CalculateBoundingBox(ADest: TFPCustomCanvas; var ALeft, ATop, ARight, ABottom: Double); virtual;
@ -228,6 +229,7 @@ type
ClipPath: TPath; ClipPath: TPath;
ClipMode: TvClipMode; ClipMode: TvClipMode;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; override;
procedure Assign(ASource: TPath); procedure Assign(ASource: TPath);
procedure PrepareForSequentialReading; procedure PrepareForSequentialReading;
function Next(): TPathSegment; function Next(): TPathSegment;
@ -702,6 +704,13 @@ constructor TvEntity.Create;
begin begin
end; end;
procedure TvEntity.Clear;
begin
X := 0.0;
Y := 0.0;
Z := 0.0;
end;
procedure TvEntity.CalculateBoundingBox(ADest: TFPCustomCanvas; var ALeft, ATop, ARight, ABottom: Double); procedure TvEntity.CalculateBoundingBox(ADest: TFPCustomCanvas; var ALeft, ATop, ARight, ABottom: Double);
begin begin
ALeft := X; ALeft := X;
@ -788,6 +797,12 @@ end;
//GM: Follow the path to cleanly release the chained list! //GM: Follow the path to cleanly release the chained list!
destructor TPath.Destroy; destructor TPath.Destroy;
begin
Clear;
inherited Destroy;
end;
procedure TPath.Clear;
var var
p, pp, np: TPathSegment; p, pp, np: TPathSegment;
begin begin
@ -815,7 +830,8 @@ begin
end; end;
PointsEnd:=nil; PointsEnd:=nil;
Points:=nil; Points:=nil;
inherited Destroy;
inherited Clear;
end; end;
procedure TPath.Assign(ASource: TPath); procedure TPath.Assign(ASource: TPath);
@ -1821,6 +1837,12 @@ destructor TvVectorialPage.Destroy;
begin begin
Clear; Clear;
if FTmpPath <> nil then
begin
FTmpPath.Free;
FTmpPath := nil;
end;
FEntities.Free; FEntities.Free;
FEntities := nil; FEntities := nil;
@ -1877,11 +1899,7 @@ procedure TvVectorialPage.Clear;
begin begin
FEntities.ForEachCall(CallbackDeleteEntity, nil); FEntities.ForEachCall(CallbackDeleteEntity, nil);
FEntities.Clear(); FEntities.Clear();
if FTmpPath <> nil then ClearTmpPath();
begin
FTmpPath.Free;
FTmpPath := nil;
end;
end; end;
{@@ {@@