diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 2d2d351f090..9e6868cf02f 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -5737,6 +5737,8 @@ QString QString::simplified_helper(const QString &str) QString QString::simplified_helper(QString &str) { + if (IS_RAW_DATA(str.d)) // Force a copy, even if not shared: + return QStringAlgorithms::simplified_helper(str); return QStringAlgorithms::simplified_helper(str); } diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 6bd9e5c25a5..2816ba3bd3d 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -2547,6 +2547,7 @@ void tst_QLocale::monthName() QCOMPARE(c.monthName(1, QLocale::LongFormat), QLatin1String("January")); QCOMPARE(c.monthName(1, QLocale::ShortFormat), QLatin1String("Jan")); QCOMPARE(c.monthName(1, QLocale::NarrowFormat), QLatin1String("1")); + QCOMPARE(c.monthName(3).simplified(), "March"); // QTBUG-113415 (crash) const QLocale de("de_DE"); QCOMPARE(de.monthName(12, QLocale::LongFormat), QLatin1String("Dezember"));