summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-03-22 11:39:24 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-22 21:20:41 +0000
commit917e766ede07c3ec709394c4dc50e77ae0f8e16a (patch)
treec60250ca88c001c5ec70f200cb02b45cf92054b5
parent620ec4bd497396f70e674bc4acb0876f1f596a31 (diff)
Revert "Use unique_ptr to clarify ownership of QQuickDefaultClipNode objects"
This reverts commit 02c6e7bc3aca42a188b772aa9794b919e60017e7. It broke text selection, the currentClipNode pointer must not be reset to nullptr even if ownership is transferred to a node. Change-Id: Ia66f7ed4be17916f3725bd3cb2cbd0e7c9d6327a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 68324c56c1b8f4ad5dfcdc6f77abda3eedaf2dfd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/items/qquicktextnodeengine.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp
index 38f199ecc0..dd666416e8 100644
--- a/src/quick/items/qquicktextnodeengine.cpp
+++ b/src/quick/items/qquicktextnodeengine.cpp
@@ -257,7 +257,7 @@ void QQuickTextNodeEngine::processCurrentLine()
QVarLengthArray<TextDecoration> pendingOverlines;
QVarLengthArray<TextDecoration> pendingStrikeOuts;
if (!sortedIndexes.isEmpty()) {
- std::unique_ptr<QQuickDefaultClipNode> currentClipNode(m_hasSelection ? new QQuickDefaultClipNode(QRectF()) : nullptr);
+ QQuickDefaultClipNode *currentClipNode = m_hasSelection ? new QQuickDefaultClipNode(QRectF()) : nullptr;
bool currentClipNodeUsed = false;
for (int i=0; i<=sortedIndexes.size(); ++i) {
BinaryTreeNode *node = nullptr;
@@ -305,7 +305,7 @@ void QQuickTextNodeEngine::processCurrentLine()
if (currentClipNode != nullptr) {
if (!currentClipNodeUsed) {
- currentClipNode.reset();
+ delete currentClipNode;
} else {
currentClipNode->setIsRectangular(true);
currentClipNode->setRect(currentRect);
@@ -314,9 +314,9 @@ void QQuickTextNodeEngine::processCurrentLine()
}
if (node != nullptr && m_hasSelection)
- currentClipNode.reset(new QQuickDefaultClipNode(QRectF()));
+ currentClipNode = new QQuickDefaultClipNode(QRectF());
else
- currentClipNode.reset(nullptr);
+ currentClipNode = nullptr;
currentClipNodeUsed = false;
if (node != nullptr) {
@@ -336,7 +336,7 @@ void QQuickTextNodeEngine::processCurrentLine()
if (node != nullptr) {
if (node->selectionState == Selected) {
- node->clipNode = currentClipNode.release();
+ node->clipNode = currentClipNode;
currentClipNodeUsed = true;
}