mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix T40923: An error from a python controller on a LibFreed object causes a crash
This commit is contained in:
parent
eaf6f9fc5d
commit
4af848e557
2 changed files with 6 additions and 1 deletions
|
|
@ -263,7 +263,11 @@ PyAttributeDef SCA_PythonController::Attributes[] = {
|
|||
|
||||
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();
|
||||
|
||||
/* 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++)
|
||||
{
|
||||
m_logicmgr->RemoveController(*itc);
|
||||
(*itc)->ReParent(NULL);
|
||||
}
|
||||
|
||||
SCA_ActuatorList& actuators = newobj->GetActuators();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue