Merge pull request #2913 from talentraspel/19680

locking against crash
This commit is contained in:
Brad Hefta-Gaub 2014-05-23 15:08:20 -07:00
commit 50e812a82b
2 changed files with 11 additions and 0 deletions

View file

@ -2534,6 +2534,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
if (_voxelFades.size() > 0) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"Application::displaySide() ... voxel fades...");
_voxelFadesLock.lockForWrite();
for(std::vector<VoxelFade>::iterator fade = _voxelFades.begin(); fade != _voxelFades.end();) {
fade->render();
if(fade->isDone()) {
@ -2542,6 +2543,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
++fade;
}
}
_voxelFadesLock.unlock();
}
// give external parties a change to hook in
@ -3208,7 +3210,9 @@ void Application::nodeKilled(SharedNodePointer node) {
fade.voxelDetails = rootDetails;
const float slightly_smaller = 0.99f;
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
_voxelFadesLock.lockForWrite();
_voxelFades.push_back(fade);
_voxelFadesLock.unlock();
}
// If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
@ -3239,7 +3243,9 @@ void Application::nodeKilled(SharedNodePointer node) {
fade.voxelDetails = rootDetails;
const float slightly_smaller = 0.99f;
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
_voxelFadesLock.lockForWrite();
_voxelFades.push_back(fade);
_voxelFadesLock.unlock();
}
// If the particle server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
@ -3271,7 +3277,9 @@ void Application::nodeKilled(SharedNodePointer node) {
fade.voxelDetails = rootDetails;
const float slightly_smaller = 0.99f;
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
_voxelFadesLock.lockForWrite();
_voxelFades.push_back(fade);
_voxelFadesLock.unlock();
}
// If the model server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
@ -3356,7 +3364,9 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin
fade.voxelDetails = rootDetails;
const float slightly_smaller = 0.99f;
fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller;
_voxelFadesLock.lockForWrite();
_voxelFades.push_back(fade);
_voxelFadesLock.unlock();
}
}
// store jurisdiction details for later use

View file

@ -533,6 +533,7 @@ private:
NodeBounds _nodeBoundsDisplay;
std::vector<VoxelFade> _voxelFades;
QReadWriteLock _voxelFadesLock;
ControllerScriptingInterface _controllerScriptingInterface;
QPointer<LogDialog> _logDialog;
QPointer<SnapshotShareDialog> _snapshotShareDialog;