Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1293 - TCustomGauge: Access violation when streaming
Summary: TCustomGauge: Access violation when streaming
Status: CONFIRMED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Series (show other bugs)
Version: 150420
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
: 1292 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-09-07 11:05 EDT by LNS
Modified: 2015-09-18 11:23 EDT (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version: RAD XE5


Attachments
Example Project (12.33 KB, application/zip)
2015-09-07 11:06 EDT, LNS
Details
Example Project (corrected) (5.38 KB, application/zip)
2015-09-18 06:37 EDT, LNS
Details

Note You need to log in before you can comment on or make changes to this bug.
Description LNS 2015-09-07 11:05:20 EDT
When trying to save a chart with a knob gauge after clearing the series, an access violation occurs when trying to access the value (= MandatoryValueList[0]).

See attached example.
Comment 1 LNS 2015-09-07 11:06:01 EDT
Created attachment 494 [details]
Example Project
Comment 2 sandra pazos 2015-09-18 04:40:23 EDT
*** Bug 1292 has been marked as a duplicate of this bug. ***
Comment 3 sandra pazos 2015-09-18 05:52:45 EDT
Hello Lns, 

In the example project you attached here, there isn't any Knob Gauge. Moreover, using the code below the problem doesn’t occur for us with latest TeeChart Pro VCL/FMX 2015 published

procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.Clear;
Series1.FillSampleValues(20);
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Self.Text := FloatToStr(Series1.MandatoryValueList[0]);
end;

Could you please change the code above, because we can reproduce the problem you are experiencing?
Comment 4 LNS 2015-09-18 06:37:53 EDT
Created attachment 502 [details]
Example Project (corrected)
Comment 5 LNS 2015-09-18 06:47:22 EDT
Hi Sandra,

I apologize for the mess with the corrupted example project and the duplicate issue (1292 & 1293). I had some problems filing the bug and this seems to have lead to the duplicate entries.

I attached a corrected version of the test case that should now include a simple but complete delphi project.

The problem occurs when trying to save a chart (including a TCustomGauge series) after having cleared its values. The problem originates from the GetValue method where no check is being performed on the list count. 
We solved this using a workaround for our TCustomGauge descendant by reintroducing GetValue and using the code from TGaugeSeries.GetValue (that adds "if Count=0 then Add(0)"). So my proposal would be to include that in the original TCustomGauge.GetValue. Or - from my POV even better - change it e.g. to:

function TCustomGauge.GetValue:TChartValue;
begin
  if MandatoryValueList.Count = 0 then
    result := 0
  else
    result:=MandatoryValueList[0];
end;

Kind regards,
Linus