Created
July 2, 2014 21:26
-
-
Save sapier/1a661cf78f29ca9f03b2 to your computer and use it in GitHub Desktop.
memory leak fixes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/content_cao.cpp b/src/content_cao.cpp | |
index a05936d..fe11d33 100644 | |
--- a/src/content_cao.cpp | |
+++ b/src/content_cao.cpp | |
@@ -670,6 +670,7 @@ void GenericCAO::initialize(const std::string &data) | |
{ | |
m_env->removePlayerName(m_name.c_str()); | |
} | |
+ removeFromScene(true); | |
} | |
core::aabbox3d<f32>* GenericCAO::getSelectionBox() | |
@@ -735,7 +736,7 @@ ClientActiveObject* GenericCAO::getParent() | |
void GenericCAO::removeFromScene(bool permanent) | |
{ | |
- if(permanent) // Should be true when removing the object permanently and false when refreshing (eg: updating visuals) | |
+ if((m_env != 0) && (permanent)) // Should be true when removing the object permanently and false when refreshing (eg: updating visuals) | |
{ | |
for(std::vector<u16>::iterator ci = m_children.begin(); | |
ci != m_children.end(); ci++) | |
diff --git a/src/player.cpp b/src/player.cpp | |
index f2ff590..40d4039 100644 | |
--- a/src/player.cpp | |
+++ b/src/player.cpp | |
@@ -100,6 +100,7 @@ | |
Player::~Player() | |
{ | |
+ clearHud(); | |
} | |
// Horizontal acceleration (X and Z), Y direction is ignored | |
diff --git a/src/shader.cpp b/src/shader.cpp | |
index f855a7f..ef15f29 100644 | |
--- a/src/shader.cpp | |
+++ b/src/shader.cpp | |
@@ -383,13 +383,16 @@ void load_shaders(std::string name, SourceShaderCache *sourcecache, | |
ShaderSource::~ShaderSource() | |
{ | |
- //m_shader_callback->drop(); | |
- | |
for (std::vector<IShaderConstantSetter*>::iterator iter = m_global_setters.begin(); | |
iter != m_global_setters.end(); iter++) { | |
delete *iter; | |
} | |
m_global_setters.clear(); | |
+ | |
+ if (m_shader_callback) { | |
+ m_shader_callback->drop(); | |
+ m_shader_callback = NULL; | |
+ } | |
} | |
u32 ShaderSource::getShader(const std::string &name, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment