Don't duplicate things the constructor has done

QCollator::detach() created a new QCollatorPrivate, then set some of
its fields to the values its constructor sets them to.  Don't waste
time doing that.

Change-Id: I048a1553753ae2cf03d3f61d45490f2723ee658b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2018-07-11 18:08:55 +02:00
parent baf0933415
commit a7f2c32657

View File

@ -159,9 +159,7 @@ void QCollator::detach()
{
if (d->ref.load() != 1) {
QCollatorPrivate *x = new QCollatorPrivate;
x->ref.store(1);
x->locale = d->locale;
x->collator = 0;
if (!d->ref.deref())
delete d;
d = x;