summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r--src/corelib/tools/qstring.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index f85d794..cce313b 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -1800,13 +1800,14 @@ void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar
}
QT_TRY {
- detach();
if (blen == alen) {
// replace in place
+ detach();
for (int i = 0; i < nIndices; ++i)
memcpy(d->data + indices[i], afterBuffer, alen * sizeof(QChar));
} else if (alen < blen) {
// replace from front
+ detach();
uint to = indices[0];
if (alen)
memcpy(d->data+to, after, alen*sizeof(QChar));