Commit d9a43339 authored by Marco Bubke's avatar Marco Bubke
Browse files

Qmldesigner.NodeInstances: Fix crash of puppet for list model

parent b81c2e50
...@@ -139,6 +139,17 @@ NodeInstanceView::~NodeInstanceView() ...@@ -139,6 +139,17 @@ NodeInstanceView::~NodeInstanceView()
For every ModelNode in the model a NodeInstance will be created. For every ModelNode in the model a NodeInstance will be created.
\param model Model to which the view is attached \param model Model to which the view is attached
*/ */
bool isSkippedNode(const ModelNode &node)
{
static QStringList skipList = QStringList() << "Qt/ListModel" << "QtQuick/ListModel";
if (skipList.contains(node.type()))
return true;
return false;
}
void NodeInstanceView::modelAttached(Model *model) void NodeInstanceView::modelAttached(Model *model)
{ {
AbstractView::modelAttached(model); AbstractView::modelAttached(model);
...@@ -146,7 +157,8 @@ void NodeInstanceView::modelAttached(Model *model) ...@@ -146,7 +157,8 @@ void NodeInstanceView::modelAttached(Model *model)
m_lastCrashTime.start(); m_lastCrashTime.start();
connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash())); connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash()));
nodeInstanceServer()->createScene(createCreateSceneCommand()); if (!isSkippedNode(rootModelNode()))
nodeInstanceServer()->createScene(createCreateSceneCommand());
} }
void NodeInstanceView::modelAboutToBeDetached(Model * model) void NodeInstanceView::modelAboutToBeDetached(Model * model)
...@@ -154,6 +166,11 @@ void NodeInstanceView::modelAboutToBeDetached(Model * model) ...@@ -154,6 +166,11 @@ void NodeInstanceView::modelAboutToBeDetached(Model * model)
removeAllInstanceNodeRelationships(); removeAllInstanceNodeRelationships();
nodeInstanceServer()->clearScene(createClearSceneCommand()); nodeInstanceServer()->clearScene(createClearSceneCommand());
delete nodeInstanceServer(); delete nodeInstanceServer();
m_statePreviewImage.clear();
m_baseStatePreviewImage = QImage();
removeAllInstanceNodeRelationships();
m_activeStateInstance = NodeInstance();
m_rootNodeInstance = NodeInstance();
AbstractView::modelAboutToBeDetached(model); AbstractView::modelAboutToBeDetached(model);
} }
...@@ -165,6 +182,8 @@ void NodeInstanceView::handleChrash() ...@@ -165,6 +182,8 @@ void NodeInstanceView::handleChrash()
restartProcess(); restartProcess();
} }
void NodeInstanceView::restartProcess() void NodeInstanceView::restartProcess()
{ {
if (model()) { if (model()) {
...@@ -173,20 +192,11 @@ void NodeInstanceView::restartProcess() ...@@ -173,20 +192,11 @@ void NodeInstanceView::restartProcess()
m_nodeInstanceServer = new NodeInstanceServerProxy(this, m_runModus); m_nodeInstanceServer = new NodeInstanceServerProxy(this, m_runModus);
connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash())); connect(m_nodeInstanceServer.data(), SIGNAL(processCrashed()), this, SLOT(handleChrash()));
nodeInstanceServer()->createScene(createCreateSceneCommand()); if (!isSkippedNode(rootModelNode()))
nodeInstanceServer()->createScene(createCreateSceneCommand());
} }
} }
bool isSkippedNode(const ModelNode &node)
{
static QStringList skipList = QStringList() << "Qt/ListModel" << "QtQuick/ListModel";
if (skipList.contains(node.type()))
return true;
return false;
}
void NodeInstanceView::nodeCreated(const ModelNode &createdNode) void NodeInstanceView::nodeCreated(const ModelNode &createdNode)
{ {
NodeInstance instance = loadNode(createdNode); NodeInstance instance = loadNode(createdNode);
......
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