diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/text/qregularexpression.cpp | 5 | ||||
-rw-r--r-- | src/corelib/text/qregularexpression.h | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp index 45ed3f806a..cd5cd53c55 100644 --- a/src/corelib/text/qregularexpression.cpp +++ b/src/corelib/text/qregularexpression.cpp @@ -2572,9 +2572,8 @@ QRegularExpressionMatch QRegularExpressionMatchIterator::next() return d.constData()->next; } - QRegularExpressionMatch current = d.constData()->next; - d->next = current.d.constData()->nextMatch(); - return current; + d.detach(); + return qExchange(d->next, d->next.d.constData()->nextMatch()); } /*! diff --git a/src/corelib/text/qregularexpression.h b/src/corelib/text/qregularexpression.h index efa9470685..b33c44020f 100644 --- a/src/corelib/text/qregularexpression.h +++ b/src/corelib/text/qregularexpression.h @@ -263,7 +263,7 @@ private: friend class QRegularExpressionMatchIterator; QRegularExpressionMatch(QRegularExpressionMatchPrivate &dd); - QSharedDataPointer<QRegularExpressionMatchPrivate> d; + QExplicitlySharedDataPointer<QRegularExpressionMatchPrivate> d; }; Q_DECLARE_SHARED(QRegularExpressionMatch) @@ -308,7 +308,7 @@ private: friend QtPrivate::QRegularExpressionMatchIteratorRangeBasedForIteratorSentinel end(const QRegularExpressionMatchIterator &) { return {}; } QRegularExpressionMatchIterator(QRegularExpressionMatchIteratorPrivate &dd); - QSharedDataPointer<QRegularExpressionMatchIteratorPrivate> d; + QExplicitlySharedDataPointer<QRegularExpressionMatchIteratorPrivate> d; }; namespace QtPrivate { |