TChart.RemoveAllSeries causes acccess violation when hovering over TChart

8 views
Skip to first unread message

Skybuck Flying

unread,
Feb 20, 2015, 7:26:38 PM2/20/15
to
Hello,

To re-produce Delphi XE 7 TChart problem/access violation:

Add a TChart to a form.
Add two buttons

add VCLTee.Series to uses clausule:

uses
...,
VCLTee.Series;

Following code causes access violation:

procedure TForm1.Button1Click(Sender: TObject);
var
vLineSeries : TLineSeries;
begin
vLineSeries := TLineSeries.Create( Chart1 );
Chart1.AddSeries(vLineSeries);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Chart1.RemoveAllSeries;
end;

Press Button1 a couple of times.
Press Button2 a couple of times.

Press Button1 a couple of times.
Press Button2 a couple of times.

Then hold Button2... and move mouse across TChart... then let Button2 go.

Thus:

Once the mouse is hovering over the TChart and the button2/remove is called
an access violation occurs ?!

How to solve this problem ?

(I suspect the line selection feature might be causing an access violation,
maybe it's expecting lines or something, or something else is causing it
within TChart).

Suggestions for working-work-arounds are welcome !!!

(Also let me know if the code above is somehow flawed ?!?)

Bye,
Skybuck.

Skybuck Flying

unread,
Feb 20, 2015, 7:44:16 PM2/20/15
to
I think my hunch was correct, there is simply a bug in TChart when overing:

00673434 E813000000 call TChartSeries.GetSelected
00673439 8BD7 mov edx,edi
0067343B E8FCFAFFFF call TTeeSelected.SetHoverIndex
VCLTee.TeEngine.pas.10750:
00673440 0FB6442408 movzx eax,[esp+$08]
00673445 83C40C add esp,$0c
00673448 5F pop edi
00673449 5E pop esi
0067344A 5B pop ebx
0067344B C3 ret
TChartSeries.GetSelected:
0067344C 53 push ebx
0067344D 8BD8 mov ebx,eax
VCLTee.TeEngine.pas.10754:
0067344F 83BBAC00000000 cmp dword ptr [ebx+$000000ac],$00 *** ACCESS
VIOLATIONS ***
00673456 7514 jnz $0067346c

Hmmm... maybe hover index can be disabled somehow or so... not sure.

Bye,
Skybuck.

Skybuck Flying

unread,
Feb 20, 2015, 7:46:35 PM2/20/15
to
Ok this seems to solve it:

procedure TForm1.Button2Click(Sender: TObject);
begin
Chart1.Hover.Visible := False;
Chart1.RemoveAllSeries;
end;

Not exactly sure what however.visible does... but so far so good.

If I get any more access violations I'll let you know ! ;)

Bye,
Skybuck.

Skybuck Flying

unread,
Feb 20, 2015, 7:49:35 PM2/20/15
to
Hmmm setting it back to true after remove all series causes an access
violation again:

procedure TForm1.Button2Click(Sender: TObject);
begin
Chart1.Hover.Visible := False; // seems to solve access violations ! ;)
Chart1.RemoveAllSeries;
Chart1.Hover.Visible := True; // unfortunately this causes an access
violation again ! ;)
end;

Perhaps hover.visible can be left false always... not yet sure what it's
for... I suspect chart resizing and zooming in/out or so..

Bye,
Skybuck.

Skybuck Flying

unread,
Feb 20, 2015, 7:53:52 PM2/20/15
to
Hover is undocumented in Delphi XE 7... so for now

However the website has info on it, apperently it's a new feature since
2012:

http://www.steema.com/linkIn/WhatsNewVCL

"
When moving the mouse over some parts of a Chart, they are now highlighted.
This includes Series points, Legend, Axis labels and Annotation objects.

To disable hovering completely for a given chart, set the Hover.Visible
property to False:

Chart1.Hover.Visible := False;
When the above is True (the default), hovering can still be deactivated for
individual items:
// Series
Series1.Selected.Hover.Visible := False;

// Chart Legend
Chart1.Legend.Selected.Hover.Visible:=False;

// Axis labels
Chart1.Axes.Left.Texts.Selected.Visible:=False;
New tabs at editor dialogs allow customizing the new Selected and Hover
properties
"

I will try and disable this for now... it's not that great of a feature...
just a minor one.. not worth an access violation ;)

Bye,
Skybuck.

Reply all
Reply to author
Forward
0 new messages