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 <thiago.macieira@intel.com>
bb10
Edward Welbourne 2018-07-11 18:15:13 +02:00
parent 10a88b8149
commit baf0933415
1 changed files with 2 additions and 5 deletions

View File

@ -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;
}
/*!