Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list plotCurve->setZ() causes the ordering of items in the list to change