TAChart: Fix crash when Hide is called for an inactive chart tool.

This commit is contained in:
wp_xyz 2024-12-12 11:58:38 +01:00
parent c17363c521
commit 72a834edba
2 changed files with 15 additions and 9 deletions

View File

@ -2182,20 +2182,26 @@ end;
{ TBasicChartTool } { TBasicChartTool }
procedure TBasicChartTool.Activate; procedure TBasicChartTool.Activate;
begin
if Assigned(FChart) then
begin begin
FChart.FActiveToolIndex := Index; FChart.FActiveToolIndex := Index;
FChart.MouseCapture := true; FChart.MouseCapture := true;
FChart.FDisablePopupMenu := false; FChart.FDisablePopupMenu := false;
FStartMousePos := Mouse.CursorPos; FStartMousePos := Mouse.CursorPos;
end; end;
end;
procedure TBasicChartTool.Deactivate; procedure TBasicChartTool.Deactivate;
begin
if Assigned(FChart) then
begin begin
FChart.MouseCapture := false; FChart.MouseCapture := false;
FChart.FActiveToolIndex := -1; FChart.FActiveToolIndex := -1;
if PopupMenuConflict then if PopupMenuConflict then
FChart.FDisablePopupMenu := true; FChart.FDisablePopupMenu := true;
end; end;
end;
function TBasicChartTool.PopupMenuConflict: Boolean; function TBasicChartTool.PopupMenuConflict: Boolean;
begin begin

View File

@ -2211,7 +2211,7 @@ begin
ADrawer.SetXor(false); ADrawer.SetXor(false);
end; end;
tdmNormal: tdmNormal:
FChart.StyleChanged(Self); if Assigned(FChart) then FChart.StyleChanged(Self);
end; end;
end; end;