forked from bartvdbraak/blender
Fix T40923: An error from a python controller on a LibFreed object causes a crash
This commit is contained in:
parent
eaf6f9fc5d
commit
4af848e557
@ -263,7 +263,11 @@ PyAttributeDef SCA_PythonController::Attributes[] = {
|
|||||||
|
|
||||||
void SCA_PythonController::ErrorPrint(const char *error_msg)
|
void SCA_PythonController::ErrorPrint(const char *error_msg)
|
||||||
{
|
{
|
||||||
printf("%s - object '%s', controller '%s':\n", error_msg, GetParent()->GetName().Ptr(), GetName().Ptr());
|
// If GetParent() is NULL, then most likely the object this controller
|
||||||
|
// was attached to is gone (e.g., removed by LibFree()).
|
||||||
|
const char *obj_name = (GetParent()) ? GetParent()->GetName().ReadPtr() : "Unavailable";
|
||||||
|
const char *ctr_name = (GetParent()) ? GetName().ReadPtr() : "Unavailable";
|
||||||
|
printf("%s - object '%s', controller '%s':\n", error_msg, obj_name, ctr_name);
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
|
|
||||||
/* Added in 2.48a, the last_traceback can reference Objects for example, increasing
|
/* Added in 2.48a, the last_traceback can reference Objects for example, increasing
|
||||||
|
@ -1038,6 +1038,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
|
|||||||
!(itc==controllers.end());itc++)
|
!(itc==controllers.end());itc++)
|
||||||
{
|
{
|
||||||
m_logicmgr->RemoveController(*itc);
|
m_logicmgr->RemoveController(*itc);
|
||||||
|
(*itc)->ReParent(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCA_ActuatorList& actuators = newobj->GetActuators();
|
SCA_ActuatorList& actuators = newobj->GetActuators();
|
||||||
|
Loading…
Reference in New Issue
Block a user