From fd47602945d1a4103a8f9d79cecc5c494cdea710 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 3 Mar 2014 12:49:34 -0800 Subject: [PATCH] various particle crash and deadlock fixes --- interface/src/ParticleTreeRenderer.cpp | 5 +---- libraries/octree/src/OctreeElement.cpp | 2 +- libraries/particles/src/ParticleTree.cpp | 2 ++ libraries/particles/src/ParticlesScriptingInterface.h | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/interface/src/ParticleTreeRenderer.cpp b/interface/src/ParticleTreeRenderer.cpp index d9d0849c94..59784c8c1f 100644 --- a/interface/src/ParticleTreeRenderer.cpp +++ b/interface/src/ParticleTreeRenderer.cpp @@ -33,10 +33,7 @@ void ParticleTreeRenderer::init() { void ParticleTreeRenderer::update() { if (_tree) { ParticleTree* tree = static_cast(_tree); - if (tree->tryLockForWrite()) { - tree->update(); - tree->unlock(); - } + tree->update(); } } diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index 0cb1922df4..67b96b4047 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -739,7 +739,7 @@ void OctreeElement::setChildAtIndex(int childIndex, OctreeElement* child) { _externalChildrenMemoryUsage += NUMBER_OF_CHILDREN * sizeof(OctreeElement*); } else if (previousChildCount == 2 && newChildCount == 1) { - assert(child); // we are removing a child, so this must be true! + assert(!child); // we are removing a child, so this must be true! OctreeElement* previousFirstChild = _children.external[firstIndex]; OctreeElement* previousSecondChild = _children.external[secondIndex]; delete[] _children.external; diff --git a/libraries/particles/src/ParticleTree.cpp b/libraries/particles/src/ParticleTree.cpp index b422b8e4e8..e257237f7a 100644 --- a/libraries/particles/src/ParticleTree.cpp +++ b/libraries/particles/src/ParticleTree.cpp @@ -487,7 +487,9 @@ void ParticleTree::update() { } // prune the tree... + lockForWrite(); recurseTreeWithOperation(pruneOperation, NULL); + unlock(); } diff --git a/libraries/particles/src/ParticlesScriptingInterface.h b/libraries/particles/src/ParticlesScriptingInterface.h index 3aa19629f0..ee21424f11 100644 --- a/libraries/particles/src/ParticlesScriptingInterface.h +++ b/libraries/particles/src/ParticlesScriptingInterface.h @@ -30,12 +30,10 @@ public: private slots: /// inbound slots for external collision systems void forwardParticleCollisionWithVoxel(const ParticleID& particleID, const VoxelDetail& voxel) { - qDebug() << "forwardParticleCollisionWithVoxel()"; emit particleCollisionWithVoxel(particleID, voxel); } void forwardParticleCollisionWithParticle(const ParticleID& idA, const ParticleID& idB) { - qDebug() << "forwardParticleCollisionWithParticle()"; emit particleCollisionWithParticle(idA, idB); }