summaryrefslogtreecommitdiff
path: root/src/gui/text/qtextformat.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-15 13:23:02 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-16 09:48:09 +0200
commitada6e4fbe9f363a33d4f9341bbc468d22c0c1442 (patch)
tree41abb0dfbd9c3dc5566d4679ceee6a6f673e97de /src/gui/text/qtextformat.cpp
parentb002c48cc799ebe613ed5fadebd0f5956e214388 (diff)
downloadqtbase-ada6e4fbe9f363a33d4f9341bbc468d22c0c1442.tar.gz
Fix some bad uses of QSharedPointerData::operator T*
Avoid detaching where possible Change-Id: I438d3e66689aeef05951af86a48af2a6910da7c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/text/qtextformat.cpp')
-rw-r--r--src/gui/text/qtextformat.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index af1fdfa653..850b4ad43d 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -919,13 +919,13 @@ void QTextFormat::merge(const QTextFormat &other)
if (!other.d)
return;
- QTextFormatPrivate *d = this->d;
+ QTextFormatPrivate *p = d.data();
- const QList<QT_PREPEND_NAMESPACE(Property)> &otherProps = other.d->props;
- d->props.reserve(d->props.size() + otherProps.size());
+ const QList<QT_PREPEND_NAMESPACE(Property)> &otherProps = other.d.constData()->props;
+ p->props.reserve(p->props.size() + otherProps.size());
for (int i = 0; i < otherProps.count(); ++i) {
- const QT_PREPEND_NAMESPACE(Property) &p = otherProps.at(i);
- d->insertProperty(p.key, p.value);
+ const QT_PREPEND_NAMESPACE(Property) &prop = otherProps.at(i);
+ p->insertProperty(prop.key, prop.value);
}
}
@@ -1261,10 +1261,10 @@ int QTextFormat::objectIndex() const
void QTextFormat::setObjectIndex(int o)
{
if (o == -1) {
- if (d)
+ if (d.constData())
d->clearProperty(ObjectIndex);
} else {
- if (!d)
+ if (!d.constData())
d = new QTextFormatPrivate;
// ### type
d->insertProperty(ObjectIndex, o);