From bbf0752a3d46348fb92356365f3b68953785b26d Mon Sep 17 00:00:00 2001 From: Christoph Heiss Date: Sat, 10 Feb 2018 15:23:04 +0100 Subject: [PATCH] Fix unit test 'LoaderDFF/test_clump_clone'. This test crashed apparently only on macOS, although it should have not worked on Linux as well as it exhibits undefined behavior Anyway, the cause was passing a uninitialized variable into OpenGL as a buffer id. Just initialize it with 0 (reserved 'no object' id) and check before using it. --- rwlib/source/data/Clump.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rwlib/source/data/Clump.cpp b/rwlib/source/data/Clump.cpp index 0a47f3bd..0e664512 100644 --- a/rwlib/source/data/Clump.cpp +++ b/rwlib/source/data/Clump.cpp @@ -7,11 +7,13 @@ #include -Geometry::Geometry() : flags(0) { +Geometry::Geometry() : EBO(0), flags(0) { } Geometry::~Geometry() { - glDeleteBuffers(1, &EBO); + if (EBO) { + glDeleteBuffers(1, &EBO); + } } ModelFrame::ModelFrame(unsigned int index, glm::mat3 dR, glm::vec3 dT)