Commit 28867b78 authored by Lasse Holmstedt's avatar Lasse Holmstedt
Browse files

Remove context if it is destroyed

parent bb596688
......@@ -217,6 +217,7 @@ bool SubcomponentEditorTool::itemIsChildOfQmlSubComponent(QGraphicsItem *item) c
void SubcomponentEditorTool::pushContext(QGraphicsObject *contextItem)
{
connect(contextItem, SIGNAL(destroyed(QObject*)), SLOT(contextDestroyed(QObject*)));
m_currentContext.push(contextItem);
}
......@@ -247,4 +248,17 @@ QGraphicsObject *SubcomponentEditorTool::currentRootItem() const
return m_currentContext.top();
}
void SubcomponentEditorTool::contextDestroyed(QObject *contextToDestroy)
{
disconnect(contextToDestroy, SIGNAL(destroyed(QObject*)), this, SLOT(contextDestroyed(QObject*)));
// pop out the whole context - it might not be safe anymore.
while (m_currentContext.size() > 1) {
m_currentContext.pop();
}
m_mask->setVisible(false);
}
} // namespace QmlViewer
......@@ -57,6 +57,7 @@ protected:
private slots:
void animate();
void contextDestroyed(QObject *context);
private:
void aboutToPopContext();
......
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