From dab3121d59b202eac72a0b7d0fa101532ac080cd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 31 May 2010 19:47:52 +0200 Subject: fix setRawData() setRawData() itself (consistently with fromRawData()) sets alloc to the passed raw size, so the check at the start would always find that we cannot re-use the qstring object, thus completely defeating the purpose of the function. so also check that the string data pointer actually points into the internal array before giving up. Reviewed-by: olivier --- src/corelib/tools/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 6acbcec..a0dbb8e 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7093,7 +7093,7 @@ QString QString::fromRawData(const QChar *unicode, int size) */ QString &QString::setRawData(const QChar *unicode, int size) { - if (d->ref != 1 || d->alloc) { + if (d->ref != 1 || (d->data == d->array && d->alloc)) { *this = fromRawData(unicode, size); } else { #ifdef QT3_SUPPORT -- cgit v0.12