Skip to content

Commit 528c8a6

Browse files
committedNov 8, 2018
[3d] fix inevitable crashes when terrain bounding boxes were shown
The list of vertices just kept growing and growing (and we didn't even need another copy!)
1 parent 222f0a0 commit 528c8a6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎src/3d/chunks/qgschunkboundsentity_p.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ void LineMeshGeometry::setVertices( const QList<QVector3D> &vertices )
4848
rawVertexArray[idx++] = v.x();
4949
rawVertexArray[idx++] = v.y();
5050
rawVertexArray[idx++] = v.z();
51-
mVertices.append( v );
5251
}
5352

53+
mVertexCount = vertices.count();
5454
mVertexBuffer->setData( vertexBufferData );
5555
}
5656

‎src/3d/chunks/qgschunkboundsentity_p.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ class LineMeshGeometry : public Qt3DRender::QGeometry
6767

6868
int vertexCount()
6969
{
70-
return mVertices.size();
70+
return mVertexCount;
7171
}
7272

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

7575
private:
7676
Qt3DRender::QAttribute *mPositionAttribute = nullptr;
7777
Qt3DRender::QBuffer *mVertexBuffer = nullptr;
78-
QList<QVector3D> mVertices;
78+
int mVertexCount = 0;
7979

8080
};
8181

0 commit comments

Comments
 (0)
Please sign in to comment.