Skip to content

Commit 5c96f07

Browse files
committed
Fixed crash when creating new file while there was links in the current scene
1 parent 9ede9f3 commit 5c96f07

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

NodalScene.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void NodalScene::load(QString fileName, qreal& duration)
119119

120120
duration = root["duration"].toDouble();
121121

122-
clearItems(1);
122+
reset();
123123

124124
// ============== CREATE COMPONENTS =============
125125
if(!Utils::CheckJsonValue(root, "components", QJsonValue::Array, 120))
@@ -135,6 +135,7 @@ int NodalScene::clearItems(int from)
135135
int nbRemoved = 0;
136136
for(int i = m_nodeList.size()-1; i >= from; --i)
137137
{
138+
m_nodeList[i]->unlink();
138139
delete m_nodeList[i];
139140
m_nodeList.remove(i);
140141
nbRemoved++;
@@ -148,6 +149,7 @@ void NodalScene::reset()
148149
clearItems(1);
149150
m_nodeList[0]->setX(0);
150151
m_nodeList[0]->setY(0);
152+
m_nodeList[0]->setSelected(false);
151153
}
152154

153155

0 commit comments

Comments
 (0)