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 2463 - EInvalidPointer "Invalid pointer operation" exception when trying to remove a custom label from an axis
Summary: EInvalidPointer "Invalid pointer operation" exception when trying to remove a...
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Axis (show other bugs)
Version: 32.210430
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: yeray alonso
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-08 09:48 EDT by yeray alonso
Modified: 2021-10-08 09:49 EDT (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yeray alonso 2021-10-08 09:48:00 EDT
Trying to delete a custom label from an axis, using Delete(Index) method, raises an "Invalid pointer operation" exception.
This happens in new IDEs (tested in RAD 10.2 Tokyo and 11 Alexandria), but works fine in old ones (tested in RAD XE).

Ie:

procedure TForm1.Button1Click(Sender: TObject);
begin
  with Chart1.Axes.Bottom do
    if Items.Count>0 then
    begin
      //Invalid pointer operation:
      Items.Delete(0);
      //Items[0].Destroy;

      //Working without errors:
      //TList<TAxisItem>(Items).Delete(0);
    end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  //Working without errors:
  Chart1.Axes.Bottom.Items.Clear;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  Label1.Caption:='Number of bottom axis items: ' + (IntToStr(Chart1.Axes.Bottom.Items.Count));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Caption:=TeeMsg_Version;

  Chart1.Axes.Bottom.Items.Add(2,'Dog');
  Chart1.Axes.Bottom.Items.Add(3,'Cat');
  Chart1.Axes.Bottom.SetMinMax(0, 5);
end;