From 4429c6dc9e39e46cf427f939ec580d3ce92eebfb Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 29 Jul 2019 22:20:45 -0700 Subject: [PATCH] avoid Mac OSX bus error -> no large static arrays --- examples/SharedMemory/PhysicsServerCommandProcessor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index 23e0bd1e8..badf1ec33 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -2811,6 +2811,7 @@ void PhysicsServerCommandProcessor::deleteDynamicsWorld() { delete[] m_data->m_heightfieldDatas[j]; } + for (int j = 0; j < m_data->m_meshInterfaces.size(); j++) { delete m_data->m_meshInterfaces[j]; @@ -2824,6 +2825,7 @@ void PhysicsServerCommandProcessor::deleteDynamicsWorld() m_data->m_guiHelper->removeTexture(texId); } } + m_data->m_heightfieldDatas.clear(); m_data->m_allocatedTextures.clear(); m_data->m_meshInterfaces.clear(); m_data->m_collisionShapes.clear(); @@ -4321,7 +4323,8 @@ static unsigned char* MyGetRawHeightfieldData(CommonFileIOInterface& fileIO, PHY { char relativePath[1024]; int found = fileIO.findResourcePath(fileName, relativePath, 1024); - char lineBuffer[MYLINELENGTH]; + btAlignedObjectArray lineBuffer; + lineBuffer.resize(MYLINELENGTH); int slot = fileIO.fileOpen(relativePath, "r"); int rows = 0; int cols = 0; @@ -4330,7 +4333,7 @@ static unsigned char* MyGetRawHeightfieldData(CommonFileIOInterface& fileIO, PHY if (slot >= 0) { char* lineChar; - while (lineChar = fileIO.readLine(slot, lineBuffer, MYLINELENGTH)) + while (lineChar = fileIO.readLine(slot, &lineBuffer[0], MYLINELENGTH)) { rows = 0; std::string line(lineChar);