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

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

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;