Okay, here was the issue: I was reallocating that array of uitextviews like this:
Code:
//remotePairToS: top of the stack.
//remotePairSize: size of the stack
//remotePairAlloc: amount of space to add each time stack is full
if (remotePairToS == remotePairSize) { //if the stack is full...
remotePairSize += remotePairAlloc;
UITextView **tempRemoteNameView = malloc(sizeof(UITextView *) * remotePairSize);
for (int i = 0; i < remotePairToS; ++i)
tempRemoteNameView[i] = remoteNameView[i];
free(remoteNameView);
remoteNameView = tempRemoteNameView;
}
And the remotePairAlloc, via another bug, was being set to zero. I know, I know, there are classes for this. Don't bother with a lecture about classes.
So, the stack was being reallocated successfully, but not increased in size. The top-of-stack value naturally reflected bad memory, and I was writing to it.
You might say that this has nothing to do with the initialization of the object in question. Well, it doesn't! The code doesn't interact at all. But, somehow, this was causing the problem. There's a lesson in this:
use the classes that they give you as often as you can, and if you write to bad memory, the most vicious bugs will emerge, and you will be on the verge of killing yourself before you solve them.