[Bf-blender-cvs] [a15a395] master: BGE: Fix T35188: Duplicate an instance of group.

Porteries Tristan noreply at git.blender.org
Wed Oct 28 22:08:54 CET 2015


Commit: a15a3952f4270bb0ddb28d8118fc63707e065bde
Author: Porteries Tristan
Date:   Wed Oct 28 21:58:40 2015 +0100
Branches: master
https://developer.blender.org/rBa15a3952f4270bb0ddb28d8118fc63707e065bde

BGE: Fix T35188: Duplicate an instance of group.

This behavior caused a double free.
Before when we duplicated an instance of a group the new instance keep the pointer of the group but was not added in the group instance list (normal).
And during the object deletion we tried to remove the object in the instance list but anyways if it failed decrement the reference count.
Set the group and the instance list to NULL in ProcessReplica avoid these kind of problems.

===================================================================

M	source/gameengine/Ketsji/KX_GameObject.cpp

===================================================================

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 974a2e5..5e66250 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -518,6 +518,11 @@ void KX_GameObject::ProcessReplica()
 	m_pGraphicController = NULL;
 	m_pPhysicsController = NULL;
 	m_pSGNode = NULL;
+
+	/* Dupli group and instance list are set later in replication.
+	 * See KX_Scene::DupliGroupRecurse. */
+	m_pDupliGroupObject = NULL;
+	m_pInstanceObjects = NULL;
 	m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info);
 	m_pClient_info->m_gameobject = this;
 	m_actionManager = NULL;




More information about the Bf-blender-cvs mailing list