diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-04-02 00:46:20 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-04-02 00:46:20 +0400 |
commit | 51ea7645e253d50dd8936ab89c5c40dc5c952b81 (patch) | |
tree | b5c68639e8a8132b17b068521b3278f249283c4c | |
parent | 82e816eb1a8a37a9905c7a73da4555cc160c575b (diff) |
Fix BGE bug: BGE will crash if objects with display debug property is deleted (bad practice anyway). The actual deletion is now postponed until end of scene
-rw-r--r-- | source/gameengine/GameLogic/SCA_IScene.cpp | 12 | ||||
-rw-r--r-- | source/gameengine/GameLogic/SCA_IScene.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp index d4463196379..a2f0693b475 100644 --- a/source/gameengine/GameLogic/SCA_IScene.cpp +++ b/source/gameengine/GameLogic/SCA_IScene.cpp @@ -30,11 +30,22 @@ */ #include "SCA_IScene.h" +#include "Value.h" #ifdef HAVE_CONFIG_H #include <config.h> #endif +SCA_DebugProp::SCA_DebugProp(): m_obj(NULL) +{ +} + +SCA_DebugProp::~SCA_DebugProp() +{ + if (m_obj) + m_obj->Release(); +} + SCA_IScene::SCA_IScene() { } @@ -64,6 +75,7 @@ void SCA_IScene::AddDebugProperty(class CValue* debugprop, { SCA_DebugProp* dprop = new SCA_DebugProp(); dprop->m_obj = debugprop; + debugprop->AddRef(); dprop->m_name = name; m_debugList.push_back(dprop); } diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h index 3c62ec91515..5aa631f6b4d 100644 --- a/source/gameengine/GameLogic/SCA_IScene.h +++ b/source/gameengine/GameLogic/SCA_IScene.h @@ -40,6 +40,8 @@ struct SCA_DebugProp { class CValue* m_obj; STR_String m_name; + SCA_DebugProp(); + ~SCA_DebugProp(); }; class SCA_IScene |