forked from Mirrorlandia_minetest/minetest
src/client.cpp: Fix mapper memory leak
This commit is contained in:
parent
42cf5e972d
commit
ebe7b31538
@ -291,7 +291,7 @@ Client::~Client()
|
|||||||
|
|
||||||
m_mesh_update_thread.Stop();
|
m_mesh_update_thread.Stop();
|
||||||
m_mesh_update_thread.Wait();
|
m_mesh_update_thread.Wait();
|
||||||
while(!m_mesh_update_thread.m_queue_out.empty()) {
|
while (!m_mesh_update_thread.m_queue_out.empty()) {
|
||||||
MeshUpdateResult r = m_mesh_update_thread.m_queue_out.pop_frontNoEx();
|
MeshUpdateResult r = m_mesh_update_thread.m_queue_out.pop_frontNoEx();
|
||||||
delete r.mesh;
|
delete r.mesh;
|
||||||
}
|
}
|
||||||
@ -300,20 +300,22 @@ Client::~Client()
|
|||||||
delete m_inventory_from_server;
|
delete m_inventory_from_server;
|
||||||
|
|
||||||
// Delete detached inventories
|
// Delete detached inventories
|
||||||
for(std::map<std::string, Inventory*>::iterator
|
for (std::map<std::string, Inventory*>::iterator
|
||||||
i = m_detached_inventories.begin();
|
i = m_detached_inventories.begin();
|
||||||
i != m_detached_inventories.end(); i++){
|
i != m_detached_inventories.end(); ++i) {
|
||||||
delete i->second;
|
delete i->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
// cleanup 3d model meshes on client shutdown
|
// cleanup 3d model meshes on client shutdown
|
||||||
while (m_device->getSceneManager()->getMeshCache()->getMeshCount() != 0) {
|
while (m_device->getSceneManager()->getMeshCache()->getMeshCount() != 0) {
|
||||||
scene::IAnimatedMesh * mesh =
|
scene::IAnimatedMesh *mesh =
|
||||||
m_device->getSceneManager()->getMeshCache()->getMeshByIndex(0);
|
m_device->getSceneManager()->getMeshCache()->getMeshByIndex(0);
|
||||||
|
|
||||||
if (mesh != NULL)
|
if (mesh != NULL)
|
||||||
m_device->getSceneManager()->getMeshCache()->removeMesh(mesh);
|
m_device->getSceneManager()->getMeshCache()->removeMesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete m_mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::connect(Address address,
|
void Client::connect(Address address,
|
||||||
|
Loading…
Reference in New Issue
Block a user