TextBuffer::ResizeTraditional may leak stale pointers
lhecker opened this issue · comments
Leonard Hecker commented
The catch clause will allow BufferAllocator
to be destroyed while the ROW
s in _storage
continue to reference its memory. The solution is to refactor ROW::Resize
from being a mutating function over to allocating a new _storage
vector and copying all rows over. That way the TextBuffer
is only mutated once at the end, long after all throwing code has finished executing.
Mike Griese commented
Leonard Hecker commented
Oh, yes, thank you!