View Issue Details

IDProjectCategoryView StatusLast Update
0035337LazarusTAChartpublic2019-04-08 02:14
ReporterMarcin WiazowskiAssigned Towp 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1 (SVN)Product Build60865 
Target Version2.2Fixed in Version 
Summary0035337: TAChart: chart tools may try to use uninitialized chart scaling
DescriptionLaunch the attached Reproduce application. It starts with an exception: "[Chart1.XImageToGraph]: Image-graph scaling not yet initialized".

This is because chart's MouseMove event is fired immediately after the chart appears on the screen, so chart tool tries to do its work - but chart's scaling is not yet initialized.

Possible solution is quite simple: chart tools have nothing to do, when chart's scaling is not yet initialized - so it's enough to check for valid scaling in TChartToolset.Dispatch(), as it is performed in the attached patch.
TagsNo tags attached.
Fixed in Revision60894
LazTarget2.2
WidgetsetWin32/Win64
Attached Files
  • Reproduce.zip (2,251 bytes)
  • patch.diff (442 bytes)
    Index: components/tachart/tatools.pas
    ===================================================================
    --- components/tachart/tatools.pas	(revision 60865)
    +++ components/tachart/tatools.pas	(working copy)
    @@ -1038,7 +1038,7 @@
     var
       i, ai: Integer;
     begin
    -  if Tools.Count = 0 then exit(false);
    +  if (Tools.Count = 0) or (not AChart.ScalingValid) then exit(false);
     
       SetLength(candidates, Tools.Count);
       candidateCount := 0;
    
    patch.diff (442 bytes)

Activities

Marcin Wiazowski

2019-04-07 17:25

reporter  

Reproduce.zip (2,251 bytes)

Marcin Wiazowski

2019-04-07 17:25

reporter  

patch.diff (442 bytes)
Index: components/tachart/tatools.pas
===================================================================
--- components/tachart/tatools.pas	(revision 60865)
+++ components/tachart/tatools.pas	(working copy)
@@ -1038,7 +1038,7 @@
 var
   i, ai: Integer;
 begin
-  if Tools.Count = 0 then exit(false);
+  if (Tools.Count = 0) or (not AChart.ScalingValid) then exit(false);
 
   SetLength(candidates, Tools.Count);
   candidateCount := 0;
patch.diff (442 bytes)

wp

2019-04-08 00:03

developer   ~0115315

Applied, thanks.

Marcin Wiazowski

2019-04-08 02:14

reporter   ~0115318

Confirmed, thanks.

Issue History

Date Modified Username Field Change
2019-04-07 17:25 Marcin Wiazowski New Issue
2019-04-07 17:25 Marcin Wiazowski File Added: Reproduce.zip
2019-04-07 17:25 Marcin Wiazowski File Added: patch.diff
2019-04-07 20:01 wp Assigned To => wp
2019-04-07 20:01 wp Status new => assigned
2019-04-08 00:03 wp Fixed in Revision => 60894
2019-04-08 00:03 wp LazTarget => 2.2
2019-04-08 00:03 wp Note Added: 0115315
2019-04-08 00:03 wp Status assigned => resolved
2019-04-08 00:03 wp Resolution open => fixed
2019-04-08 00:03 wp Target Version => 2.2
2019-04-08 02:14 Marcin Wiazowski Note Added: 0115318
2019-04-08 02:14 Marcin Wiazowski Status resolved => closed