Page 1 of 1

Application exception : Invalid pointer operation

Posted: Tue Jun 14, 2011 7:07 pm
by 10050999
I am trying to diagnose a problem that occurs when I exit from my application. I am getting an Application exception : Invalid pointer operation. I was originally using TeeChart 8.07, but I upgraded to 8.08 to see if this would help... it did not.

The stack trace is attached as a jpeg.

I believe that the problem is related to the FreeAllSeries method. I have tried to with several different variations of the following:

BarChartSeries : array of TCustomBarSeries;

for i := Low(BarChartSeries) to High(BarChartSeries) do
begin
if(BarChartSeries <> nil) then
begin
// BarChartSeries.Clear();
// BarChartSeries.Destroy();
BarChartSeries.Free();
BarChartSeries := nil;
end;
end;

or this

ChartHMICBEMA: TChart;

for i := 0 to ChartHMICBEMA.SeriesCount - 1 do
begin
if(ChartHMICBEMA.Series <> nil) then
begin
ChartHMICBEMA.Series.Free();
end;
end;
ChartHMICBEMA.Free();



The result is that I get the invalid pointer operation during execution instead of on exit. Is either of these a correct alternative to FreeAllSeries()?

Thanks,
Kent

Re: Application exception : Invalid pointer operation

Posted: Thu Jun 16, 2011 7:58 am
by narcis
Hi Kent,
The result is that I get the invalid pointer operation during execution instead of on exit. Is either of these a correct alternative to FreeAllSeries()?
It's much easier, try using RemoveAllSeries:

Code: Select all

  Chart1.RemoveAllSeries;
And RemoveSeries for a single series:

Code: Select all

  Chart1.RemoveSeries(Series1);
Or:

Code: Select all

  Chart1.RemoveSeries(0);
If the problem persists please attach a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.