Skip to content

Commit

Permalink
[3d] fix inevitable crashes when terrain bounding boxes were shown
Browse files Browse the repository at this point in the history
The list of vertices just kept growing and growing (and we didn't even need another copy!)

(cherry picked from commit 528c8a6)
  • Loading branch information
wonder-sk authored and nyalldawson committed Nov 10, 2018
1 parent b9a1a6c commit f260700
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/3d/chunks/qgschunkboundsentity_p.cpp
Expand Up @@ -48,9 +48,9 @@ void LineMeshGeometry::setVertices( const QList<QVector3D> &vertices )
rawVertexArray[idx++] = v.x();
rawVertexArray[idx++] = v.y();
rawVertexArray[idx++] = v.z();
mVertices.append( v );
}

mVertexCount = vertices.count();
mVertexBuffer->setData( vertexBufferData );
}

Expand Down
4 changes: 2 additions & 2 deletions src/3d/chunks/qgschunkboundsentity_p.h
Expand Up @@ -67,15 +67,15 @@ class LineMeshGeometry : public Qt3DRender::QGeometry

int vertexCount()
{
return mVertices.size();
return mVertexCount;
}

void setVertices( const QList<QVector3D> &vertices );

private:
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
QList<QVector3D> mVertices;
int mVertexCount = 0;

};

Expand Down

0 comments on commit f260700

Please sign in to comment.