From baf0933415153daaeb9387dd2f6ea5da84bef04f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 11 Jul 2018 18:15:13 +0200 Subject: Set dirty in QCollator::detach() rather than calling init() Each of its callers set dirty after calling detach() in any case, so the call to init() was going to be duplicated (if the instance ever got used again for something that benefits from it), and the d-ptr is freshly created in any case, so can't be carrying any stray gunk from earlier use, that init() might purge. Change-Id: Id2485889c8ae4ee531c88562ff63f1a8ac0f4a36 Reviewed-by: Thiago Macieira --- src/corelib/tools/qcollator.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 5155badcf8..2e231003b7 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -165,8 +165,9 @@ void QCollator::detach() if (!d->ref.deref()) delete d; d = x; - d->init(); } + // All callers need this, because about to modify the object: + d->dirty = true; } /*! @@ -179,7 +180,6 @@ void QCollator::setLocale(const QLocale &locale) detach(); d->locale = locale; - d->dirty = true; } /*! @@ -204,7 +204,6 @@ void QCollator::setCaseSensitivity(Qt::CaseSensitivity cs) detach(); d->caseSensitivity = cs; - d->dirty = true; } /*! @@ -242,7 +241,6 @@ void QCollator::setNumericMode(bool on) detach(); d->numericMode = on; - d->dirty = true; } /*! @@ -275,7 +273,6 @@ void QCollator::setIgnorePunctuation(bool on) detach(); d->ignorePunctuation = on; - d->dirty = true; } /*! -- cgit v1.2.3