summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-05-31 17:47:52 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2010-06-01 13:07:59 (GMT)
commitdab3121d59b202eac72a0b7d0fa101532ac080cd (patch)
treeb5b0d033d7eabd708d215b0a0cb555e9cd489b82
parent0081d328394dea7ddcf7411ece678973a86781c9 (diff)
downloadQt-dab3121d59b202eac72a0b7d0fa101532ac080cd.zip
Qt-dab3121d59b202eac72a0b7d0fa101532ac080cd.tar.gz
Qt-dab3121d59b202eac72a0b7d0fa101532ac080cd.tar.bz2
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
-rw-r--r--src/corelib/tools/qstring.cpp2
1 files changed, 1 insertions, 1 deletions
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