forked from qt-creator/qt-creator
Utils: Fix SmallString reserve for read only references
The capacity of a real only reference is zero but the size is larger than zero. So if we reserve memory the new capacity has to be bigger than the size and the capacity. Change-Id: I8b423da7e7c1cf7cee081d1b3f3464b6fb3f67cf Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -240,6 +240,7 @@ public:
|
||||
m_data.allocated.data.capacity = newCapacity;
|
||||
} else {
|
||||
const size_type oldSize = size();
|
||||
newCapacity = std::max(newCapacity, oldSize);
|
||||
const char *oldData = data();
|
||||
|
||||
char *newData = Memory::allocate(newCapacity + 1);
|
||||
|
||||
Reference in New Issue
Block a user