Merge pull request #9140 from jherico/polyline_threading_fix

Possible polyline crash fix
This commit is contained in:
samcake 2016-12-02 14:16:14 -08:00 committed by GitHub
commit acdce95bba
2 changed files with 8 additions and 4 deletions

View file

@ -161,8 +161,12 @@ void RenderablePolyLineEntityItem::update(const quint64& now) {
uniforms.color = toGlm(getXColor());
memcpy(&_uniformBuffer.edit<PolyLineUniforms>(), &uniforms, sizeof(PolyLineUniforms));
if (_pointsChanged || _strokeWidthsChanged || _normalsChanged) {
updateVertices();
updateGeometry();
QWriteLocker lock(&_quadReadWriteLock);
_empty = (_points.size() < 2 || _normals.size() < 2 || _strokeWidths.size() < 2);
if (!_empty) {
updateVertices();
updateGeometry();
}
}
}
@ -170,8 +174,7 @@ void RenderablePolyLineEntityItem::update(const quint64& now) {
void RenderablePolyLineEntityItem::render(RenderArgs* args) {
checkFading();
QWriteLocker lock(&_quadReadWriteLock);
if (_points.size() < 2 || _normals.size () < 2 || _strokeWidths.size() < 2) {
if (_empty) {
return;
}

View file

@ -50,6 +50,7 @@ protected:
gpu::BufferPointer _verticesBuffer;
gpu::BufferView _uniformBuffer;
unsigned int _numVertices;
bool _empty { true };
QVector<glm::vec3> _vertices;
};