Commit 2d0cd790 authored by hjk's avatar hjk

TreeModel: Ensure deterministic state during child destruction

This allows tree items to rely on not being part of a model
inside their destuctors.

Change-Id: I5f19739d3701426b068a07bf82f5199fbb259f29
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 12c7f736
...@@ -624,7 +624,7 @@ TreeItem::TreeItem(const QStringList &displays, int flags) ...@@ -624,7 +624,7 @@ TreeItem::TreeItem(const QStringList &displays, int flags)
TreeItem::~TreeItem() TreeItem::~TreeItem()
{ {
clear(); removeChildren();
delete m_displays; delete m_displays;
} }
...@@ -818,6 +818,7 @@ void TreeItem::clear() ...@@ -818,6 +818,7 @@ void TreeItem::clear()
{ {
while (m_children.size()) { while (m_children.size()) {
TreeItem *item = m_children.takeLast(); TreeItem *item = m_children.takeLast();
item->m_model = 0;
item->m_parent = 0; item->m_parent = 0;
delete item; delete item;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment