Commit 86206782 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Renewed attempt to fix possible dangling pointers.

Task-number: QTCREATORBUG-807
parent bb14ad68
......@@ -75,8 +75,12 @@ NamespaceBinding::NamespaceBinding(NamespaceBinding *parent)
NamespaceBinding::~NamespaceBinding()
{
qDeleteAll(children);
qDeleteAll(classBindings);
qDeleteAll(QList<NamespaceBinding *>(children));
qDeleteAll(QList<ClassBinding *>(classBindings));
if (parent)
parent->asNamespaceBinding()->children.removeAll(this);
parent = 0;
}
const NameId *NamespaceBinding::name() const
......@@ -547,7 +551,14 @@ ClassBinding::ClassBinding(ClassBinding *parentClass)
}
ClassBinding::~ClassBinding()
{ qDeleteAll(children); }
{
qDeleteAll(QList<ClassBinding *>(children));
if (NamespaceBinding *nsBinding = parent->asNamespaceBinding())
nsBinding->classBindings.removeAll(this);
if (ClassBinding *classBinding = parent->asClassBinding())
classBinding->children.removeAll(this);
parent = 0;
}
const Name *ClassBinding::name() const
{
......
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