answer by u/tetrahedral on Reddit:
My hunch is that you are passing the text back as a MutableList somewhere and calling .clear() on it without realizing that it’s a reference to the storage. Modify getText and addText to copy into a new array and see if the problem goes away.
I was creating an alias to the mutableList when I was passing it as a parameter. when I called .clear() on it, the list was deleted in both files.