mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:19:22 +02:00
TAChart: Fix access to cached ChartListSource extents while the source is being updated. Issue #35463, patch by Marcin Wiazowski.
git-svn-id: trunk@61080 -
This commit is contained in:
parent
0979ae36e8
commit
6c66672e31
@ -849,7 +849,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FBasicExtentIsValid := true;
|
FBasicExtentIsValid := not IsUpdating; // When updating, we are not allowed
|
||||||
|
// to set "Valid" for caches - see comment in TListChartSource.ClearCaches()
|
||||||
Result := FBasicExtent;
|
Result := FBasicExtent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -888,7 +889,8 @@ begin
|
|||||||
UpdateMinMax(XList[j], FXListExtent.a.X, FXListExtent.b.X);
|
UpdateMinMax(XList[j], FXListExtent.a.X, FXListExtent.b.X);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FXListExtentIsValid := true;
|
FXListExtentIsValid := not IsUpdating; // When updating, we are not allowed
|
||||||
|
// to set "Valid" for caches - see comment in TListChartSource.ClearCaches()
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result.a.X := Min(Result.a.X, FXListExtent.a.X);
|
Result.a.X := Min(Result.a.X, FXListExtent.a.X);
|
||||||
@ -915,7 +917,8 @@ begin
|
|||||||
UpdateMinMax(YList[j], FYListExtent.a.Y, FYListExtent.b.Y);
|
UpdateMinMax(YList[j], FYListExtent.a.Y, FYListExtent.b.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FYListExtentIsValid := true;
|
FYListExtentIsValid := not IsUpdating; // When updating, we are not allowed
|
||||||
|
// to set "Valid" for caches - see comment in TListChartSource.ClearCaches()
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result.a.Y := Min(Result.a.Y, FYListExtent.a.Y);
|
Result.a.Y := Min(Result.a.Y, FYListExtent.a.Y);
|
||||||
@ -1018,7 +1021,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FCumulativeExtentIsValid := true;
|
FCumulativeExtentIsValid := not IsUpdating; // When updating, we are not allowed
|
||||||
|
// to set "Valid" for caches - see comment in TListChartSource.ClearCaches()
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result.a.Y := Min(Result.a.Y, FCumulativeExtent.a.Y);
|
Result.a.Y := Min(Result.a.Y, FCumulativeExtent.a.Y);
|
||||||
@ -1499,7 +1503,8 @@ begin
|
|||||||
for i := 0 to Count - 1 do
|
for i := 0 to Count - 1 do
|
||||||
with Item[i]^ do
|
with Item[i]^ do
|
||||||
FValuesTotal += NumberOr(Y);
|
FValuesTotal += NumberOr(Y);
|
||||||
FValuesTotalIsValid := true;
|
FValuesTotalIsValid := not IsUpdating; // When updating, we are not allowed
|
||||||
|
// to set "Valid" for caches - see comment in TListChartSource.ClearCaches()
|
||||||
Result := FValuesTotal;
|
Result := FValuesTotal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -720,16 +720,20 @@ end;
|
|||||||
|
|
||||||
procedure TListChartSource.ClearCaches;
|
procedure TListChartSource.ClearCaches;
|
||||||
begin
|
begin
|
||||||
|
// When updating, we are not allowed to set "Valid" for caches - cached
|
||||||
|
// data is not synchronized with real data when updating, so setting "Valid"
|
||||||
|
// could lead to reading outdated cache contents, when calling methods like
|
||||||
|
// BasicExtent() when still in update mode
|
||||||
FBasicExtent := EmptyExtent;
|
FBasicExtent := EmptyExtent;
|
||||||
FBasicExtentIsValid := true;
|
FBasicExtentIsValid := not IsUpdating;
|
||||||
FCumulativeExtent := EmptyExtent;
|
FCumulativeExtent := EmptyExtent;
|
||||||
FCumulativeExtentIsValid := true;
|
FCumulativeExtentIsValid := not IsUpdating;
|
||||||
FXListExtent := EmptyExtent;
|
FXListExtent := EmptyExtent;
|
||||||
FXListExtentIsValid := true;
|
FXListExtentIsValid := not IsUpdating;
|
||||||
FYListExtent := EmptyExtent;
|
FYListExtent := EmptyExtent;
|
||||||
FYListExtentIsValid := true;
|
FYListExtentIsValid := not IsUpdating;
|
||||||
FValuesTotal := 0;
|
FValuesTotal := 0;
|
||||||
FValuesTotalIsValid := true;
|
FValuesTotalIsValid := not IsUpdating;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TListChartSource.CopyFrom(ASource: TCustomChartSource);
|
procedure TListChartSource.CopyFrom(ASource: TCustomChartSource);
|
||||||
|
Loading…
Reference in New Issue
Block a user