C++ Is there a way to prevent history records from corrupting my data?

Hi:
In Rhino 7.0, history records are corrupting my data. Is there any way to resolve this issue?

The code file is here.

RhinoTest.zip (38.8 KB)