From 51ea7645e253d50dd8936ab89c5c40dc5c952b81 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Tue, 1 Apr 2008 20:46:20 +0000 Subject: 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 --- source/gameengine/GameLogic/SCA_IScene.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/gameengine/GameLogic/SCA_IScene.cpp') 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 #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); } -- cgit v1.2.3