partially fix one of the segfaults

This commit is contained in:
darkrose 2015-06-15 02:36:32 +10:00
parent ca52853243
commit a3e59f71ec
3 changed files with 10 additions and 14 deletions

View File

@ -174,15 +174,7 @@ void * MeshUpdateThread::Thread()
}else{ }else{
MapBlock *block = m_env->getMap().getBlockNoCreateNoEx(q->p); MapBlock *block = m_env->getMap().getBlockNoCreateNoEx(q->p);
if (block && block->mesh) { if (block && block->mesh) {
if (q->ack_block_to_server) {
MeshUpdateResult r;
r.p = q->p;
r.mesh = NULL;
r.ack_block_to_server = true;
m_queue_out.push_back(r);
}
block->mesh->generate(q->data, m_camera_offset, &block->mesh_mutex); block->mesh->generate(q->data, m_camera_offset, &block->mesh_mutex);
}else if (block) {
if (q->ack_block_to_server) { if (q->ack_block_to_server) {
MeshUpdateResult r; MeshUpdateResult r;
r.p = q->p; r.p = q->p;
@ -190,11 +182,12 @@ void * MeshUpdateThread::Thread()
r.ack_block_to_server = true; r.ack_block_to_server = true;
m_queue_out.push_back(r); m_queue_out.push_back(r);
} }
}else if (block) {
MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset); MapBlockMesh *mesh_new = new MapBlockMesh(q->data, m_camera_offset);
MeshUpdateResult r; MeshUpdateResult r;
r.p = q->p; r.p = q->p;
r.mesh = mesh_new; r.mesh = mesh_new;
r.ack_block_to_server = false; r.ack_block_to_server = q->ack_block_to_server;
m_queue_out.push_back(r); m_queue_out.push_back(r);
} }

View File

@ -1669,11 +1669,6 @@ void the_game(
guitext_profiler->setBackgroundColor(video::SColor(80,0,0,0)); guitext_profiler->setBackgroundColor(video::SColor(80,0,0,0));
guitext_profiler->setVisible(false); guitext_profiler->setVisible(false);
// Launch pause menu
(new GUIPauseMenu(guienv, guiroot, -1, g_gamecallback,
&g_menumgr))->drop();
client.setFormState(true);
/* /*
Some statistics are collected in these Some statistics are collected in these
*/ */

View File

@ -643,7 +643,11 @@ void MapBlockMesh::refresh(u32 daynight_ratio)
u16 mc = m_mesh->getMeshBufferCount(); u16 mc = m_mesh->getMeshBufferCount();
for (u16 j=0; j<mc; j++) { for (u16 j=0; j<mc; j++) {
scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(j); scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(j);
if (buf == 0)
continue;
video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices(); video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices();
if (vertices == 0)
continue;
u16 vc = buf->getVertexCount(); u16 vc = buf->getVertexCount();
u32 *c = m_meshdata[j].colours.data(); u32 *c = m_meshdata[j].colours.data();
for (u16 i=0; i<vc; i++) { for (u16 i=0; i<vc; i++) {
@ -653,7 +657,11 @@ void MapBlockMesh::refresh(u32 daynight_ratio)
mc = m_farmesh->getMeshBufferCount(); mc = m_farmesh->getMeshBufferCount();
for (u16 j=0; j<mc; j++) { for (u16 j=0; j<mc; j++) {
scene::IMeshBuffer *buf = m_farmesh->getMeshBuffer(j); scene::IMeshBuffer *buf = m_farmesh->getMeshBuffer(j);
if (buf == 0)
continue;
video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices(); video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices();
if (vertices == 0)
continue;
u16 vc = buf->getVertexCount(); u16 vc = buf->getVertexCount();
for (u16 i=0; i<vc; i++) { for (u16 i=0; i<vc; i++) {
vertices[i].Color = blend_light(0x0F,daynight_ratio); vertices[i].Color = blend_light(0x0F,daynight_ratio);