Skip to content

Commit

Permalink
Fix deadlock/crash when removing a model while rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Jun 5, 2018
1 parent 4e006b9 commit eeb1877
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/engines/ospray/OSPRayScene.cpp
Expand Up @@ -84,6 +84,8 @@ void OSPRayScene::commit()
if (!isModified())
return;

_activeModels.clear();

if (_rootModel)
ospRelease(_rootModel);
_rootModel = ospNewModel();
Expand All @@ -98,6 +100,10 @@ void OSPRayScene::commit()
if (!modelDescriptor->getEnabled())
continue;

// keep models from being deleted via removeModel() as long as we use
// them here
_activeModels.push_back(modelDescriptor);

auto& impl = static_cast<OSPRayModel&>(modelDescriptor->getModel());
const auto& transformation = modelDescriptor->getTransformation();

Expand Down
2 changes: 2 additions & 0 deletions plugins/engines/ospray/OSPRayScene.h
Expand Up @@ -81,6 +81,8 @@ class OSPRayScene : public Scene
OSPData _ospTransferFunctionDiffuseData{nullptr};

size_t _memoryManagementFlags{0};

ModelDescriptors _activeModels;
};
}
#endif // OSPRAYSCENE_H

0 comments on commit eeb1877

Please sign in to comment.