From 3ae65bba150b7f07ace93fde5aafdb925dfb12a0 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 17 Apr 2018 15:51:41 +0300 Subject: [PATCH] Fixed crash when importing entities from JSON multiple times This happened because the Clipboard wasn't being completely cleared between uses. This bug can also manifest in another way (if Interface doesn't crash): the imported entities appear very far away, instead of right in front of the user. This happens for the same reason as the crash: the Clipboard still contains some previously-imported entities. That causes us to calculate the wrong dimensions for the newly-imported entities which is why they are added to the domain far away. --- libraries/entities/src/EntityTree.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 9c7b46dc17..e0811141b5 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -112,6 +112,11 @@ void EntityTree::eraseAllOctreeElements(bool createNewRoot) { resetClientEditStats(); clearDeletedEntities(); + + { + QWriteLocker locker(&_needsParentFixupLock); + _needsParentFixup.clear(); + } } void EntityTree::readBitstreamToTree(const unsigned char* bitstream,