Merge pull request #6 from YosysHQ/q3k/gui-fix-dangling-tree-children
gui: treemodel: unregister from parent when we get destroyed
This commit is contained in:
commit
9c19c59d62
@ -62,6 +62,8 @@ class Item
|
|||||||
|
|
||||||
void addChild(Item *child) { children_.append(child); }
|
void addChild(Item *child) { children_.append(child); }
|
||||||
|
|
||||||
|
void deleteChild(Item *child) { children_.removeAll(child); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Item(QString name, Item *parent) : name_(name), parent_(parent)
|
Item(QString name, Item *parent) : name_(name), parent_(parent)
|
||||||
{
|
{
|
||||||
@ -100,7 +102,12 @@ class Item
|
|||||||
virtual bool canFetchMore() const { return false; }
|
virtual bool canFetchMore() const { return false; }
|
||||||
virtual void fetchMore() {}
|
virtual void fetchMore() {}
|
||||||
|
|
||||||
~Item() {}
|
~Item()
|
||||||
|
{
|
||||||
|
if (parent_ != nullptr) {
|
||||||
|
parent_->deleteChild(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// IdString is an Item that corresponds to a real element in Arch.
|
// IdString is an Item that corresponds to a real element in Arch.
|
||||||
|
Loading…
Reference in New Issue
Block a user