mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 04:28:59 +02:00
Merge pull request #9140 from jherico/polyline_threading_fix
Possible polyline crash fix
This commit is contained in:
commit
acdce95bba
2 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ protected:
|
|||
gpu::BufferPointer _verticesBuffer;
|
||||
gpu::BufferView _uniformBuffer;
|
||||
unsigned int _numVertices;
|
||||
bool _empty { true };
|
||||
QVector<glm::vec3> _vertices;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue