src/primitives.cpp

changeset 1090
ed73c4f48ca4
parent 1086
621c2e5853bb
child 1117
efcb47c64a72
--- a/src/primitives.cpp	Fri Feb 03 10:51:08 2017 +0200
+++ b/src/primitives.cpp	Sat Feb 04 14:24:16 2017 +0200
@@ -471,7 +471,7 @@
 		author = format("%1 [%2]", m_config->defaultName(), m_config->defaultUser());
 	}
 
-	document->openForEditing();
+	document->setFrozen(false);
 	document->history()->setIgnoring(false);
 	document->emplace<LDComment>(description);
 	document->emplace<LDComment>(format("Name: %1", fileName));
@@ -496,10 +496,13 @@
 	QString name = model.makeFileName();
 	LDDocument* document = m_window->documents()->getDocumentByName (name);
 
-	if (document)
-		return document;
-	else
-		return generatePrimitive(model);
+	if (not document)
+	{
+		document = generatePrimitive(model);
+		m_window->openDocumentForEditing(document);
+	}
+
+	return document;
 }
 
 /*

mercurial