I Can see the same with the following macro. l.RemoveLast(); is ok but l.RemoveAt(3) is not …
{
TList l;
TNamed *o1 = new TNamed("o1", "o1");
TNamed *o2 = new TNamed("o2", "o2");
TNamed *o3 = new TNamed("o3", "o3");
l.Add(o1);
l.Add(o2);
l.Add(o3);
l.ls();
l.AddAfter(o1,o3);
l.ls();
//l.RemoveAt(3); // Should be like RemoveLast() but is not.
l.RemoveLast();
l.ls();
}
At(idx) returns “o3”… then Remove() tries to Remove “o3”… and the 1st it found is at idx=1, and it removes this one. If you use o4 instead of o4 then it is ok: