Commit dcdc96f0 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke
Browse files

Ugly fix for crash caused by uninitialized memory access in DrawMesh.


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16906 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 33ab0f63
......@@ -242,7 +242,7 @@ DrawMeshT<Mesh>::rebuild()
}
// support faster update by only updating vertices
if (!bTriangleRebuild && !bVertexRebuild && rebuild_ == REBUILD_GEOMETRY)
if (!bTriangleRebuild && !bVertexRebuild && (rebuild_ & REBUILD_GEOMETRY))
{
// only update vertices, i.e. update values of vertices
......
......@@ -142,7 +142,7 @@ private:
unsigned long numTris;
};
enum REBUILD_TYPE {REBUILD_NONE = 0, REBUILD_FULL = 1, REBUILD_GEOMETRY = 2, REBUILD_TOPOLOGY = 4, REBUILD_TEXTURES = 5};
enum REBUILD_TYPE {REBUILD_NONE = 0, REBUILD_FULL = 1, REBUILD_GEOMETRY = 2, REBUILD_TOPOLOGY = 4, REBUILD_TEXTURES = 8};
public:
......
......@@ -141,6 +141,10 @@ update_cache()
// Update the indices for selected vertices
if (vertexIndexInvalid_) {
/*
* Hack: Force rebuild of buffers so that mapVertexToVBOIndex call doesn't SEGFAULT.
*/
if (drawMesh_) drawMesh_->getVBO();
typename Mesh::ConstVertexIter v_it(mesh_.vertices_sbegin()), v_end(mesh_.vertices_end());
......@@ -164,6 +168,11 @@ update_cache()
// Update index list of selected edges
if (edgeIndexInvalid_) {
/*
* Hack: Force rebuild of buffers so that mapVertexToVBOIndex call doesn't SEGFAULT.
*/
if (drawMesh_) drawMesh_->getVBO();
typename Mesh::ConstEdgeIter e_it(mesh_.edges_sbegin()), e_end(mesh_.edges_end());
typename Mesh::VertexHandle vh;
......@@ -189,6 +198,11 @@ update_cache()
// Update index list of selected halfedges
if (halfedgeCacheInvalid_) {
/*
* Hack: Force rebuild of buffers so that mapVertexToVBOIndex call doesn't SEGFAULT.
*/
if (drawMesh_) drawMesh_->getVBO();
typename Mesh::ConstHalfedgeIter he_it(mesh_.halfedges_sbegin()), he_end(mesh_.halfedges_end());
he_points_.clear();
......@@ -218,6 +232,11 @@ update_cache()
// update index list of selected faces
if (faceIndexInvalid_) {
/*
* Hack: Force rebuild of buffers so that mapVertexToVBOIndex call doesn't SEGFAULT.
*/
if (drawMesh_) drawMesh_->getVBO();
typename Mesh::ConstFaceIter f_it(mesh_.faces_sbegin()), f_end(mesh_.faces_end());
typename Mesh::ConstFaceVertexIter fv_it;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment