aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Jian <jianliang79@gmail.com>2014-07-17 15:40:18 +0800
committerjian liang <jianliang79@gmail.com>2014-07-23 11:11:32 +0200
commit4a793c2c803648410473f65ffd5d3a22b9d35f76 (patch)
treec440ccf01a3be6ab3af24f0d5e3bf9ec5cda35ec /src
parentac032fc1524f8e00a26580a68ed1c4dc23077c14 (diff)
Fix Node object leak in QQuickTextEditPrivate
Delete Node objects stored in textNodeMap at two places to prevent leak. Change-Id: I8eb0d1af900c94e1fab2f55b689de393e674f0aa Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktextedit.cpp6
-rw-r--r--src/quick/items/qquicktextedit_p_p.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index b042e30483..fdaef6df8e 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1777,8 +1777,12 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
d->updateType = QQuickTextEditPrivate::UpdateNone;
- if (!oldNode) // If we had any text node references, they were deleted along with the root node
+ if (!oldNode) {
+ // If we had any QQuickTextNode node references, they were deleted along with the root node
+ // But here we must delete the Node structures in textNodeMap
+ qDeleteAll(d->textNodeMap);
d->textNodeMap.clear();
+ }
RootNode *rootNode = static_cast<RootNode *>(oldNode);
TextNodeIterator nodeIterator = d->textNodeMap.begin();
diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h
index 25681c89f6..0cf7ee2850 100644
--- a/src/quick/items/qquicktextedit_p_p.h
+++ b/src/quick/items/qquicktextedit_p_p.h
@@ -111,6 +111,11 @@ public:
{
}
+ ~QQuickTextEditPrivate()
+ {
+ qDeleteAll(textNodeMap);
+ }
+
static QQuickTextEditPrivate *get(QQuickTextEdit *item) {
return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); }