Fix T40111: replaceMesh() crashes BGE when used on a parented object

The replace mesh code was still calling release() on the parent object when it
no longer needed to (due to earlier commits).
This commit is contained in:
Mitchell Stokes 2014-05-12 22:52:14 -07:00
parent aebcb3bab9
commit 43f3e79cee

@ -1166,8 +1166,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
#ifdef WITH_BULLET
bool bHasSoftBody = (!parentobj && (blendobj->gameflag & OB_SOFT_BODY));
#endif
bool releaseParent = true;
if (oldblendobj==NULL) {
if (bHasModifier || bHasShapeKey || bHasDvert || bHasArmature) {
@ -1189,7 +1187,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
true,
static_cast<BL_ArmatureObject*>( parentobj )
);
releaseParent= false;
modifierDeformer->LoadShapeDrivers(parentobj);
}
else
@ -1217,7 +1214,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
true,
static_cast<BL_ArmatureObject*>( parentobj )
);
releaseParent= false;
shapeDeformer->LoadShapeDrivers(parentobj);
}
else
@ -1243,7 +1239,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
true,
static_cast<BL_ArmatureObject*>( parentobj )
);
releaseParent= false;
newobj->SetDeformer(skinDeformer);
}
else if (bHasDvert)
@ -1260,10 +1255,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
newobj->SetDeformer(softdeformer);
}
#endif
// release parent reference if its not being used
if ( releaseParent && parentobj)
parentobj->Release();
}
}