Skip to content

Commit

Permalink
src/client.cpp: Fix mapper memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
t0suj4 authored and kwolekr committed Aug 2, 2015
1 parent 42cf5e9 commit ebe7b31
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/client.cpp
Expand Up @@ -291,7 +291,7 @@ Client::~Client()

m_mesh_update_thread.Stop();
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();
delete r.mesh;
}
Expand All @@ -300,20 +300,22 @@ Client::~Client()
delete m_inventory_from_server;

// 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.end(); i++){
i != m_detached_inventories.end(); ++i) {
delete i->second;
}

// cleanup 3d model meshes on client shutdown
while (m_device->getSceneManager()->getMeshCache()->getMeshCount() != 0) {
scene::IAnimatedMesh * mesh =
scene::IAnimatedMesh *mesh =
m_device->getSceneManager()->getMeshCache()->getMeshByIndex(0);

if (mesh != NULL)
m_device->getSceneManager()->getMeshCache()->removeMesh(mesh);
}

delete m_mapper;
}

void Client::connect(Address address,
Expand Down

0 comments on commit ebe7b31

Please sign in to comment.