Skip to content

Commit b44186f

Browse files
author
Roberto De Ioris
committed
fixed refcnt bug in deferred actor spawn, 20tab#364
1 parent e61e002 commit b44186f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/UnrealEnginePython/Private/UObject/UEPyActor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ PyObject *py_ue_actor_spawn(ue_PyUObject * self, PyObject * args, PyObject *kwar
791791
AActor *actor = world->SpawnActorDeferred<AActor>(u_class, transform);
792792
if (!actor)
793793
return PyErr_Format(PyExc_Exception, "unable to spawn a new Actor");
794-
ue_PyUObject *py_actor = ue_get_python_uobject(actor);
794+
ue_PyUObject *py_actor = ue_get_python_uobject_inc(actor);
795795
if (!py_actor)
796796
return PyErr_Format(PyExc_Exception, "uobject is in invalid state");
797797

@@ -802,6 +802,7 @@ PyObject *py_ue_actor_spawn(ue_PyUObject * self, PyObject * args, PyObject *kwar
802802
PyObject *void_ret = py_ue_set_property(py_actor, Py_BuildValue("OO", py_key, PyDict_GetItem(kwargs, py_key)));
803803
if (!void_ret)
804804
{
805+
Py_DECREF(py_iter);
805806
return PyErr_Format(PyExc_Exception, "unable to set property for new Actor");
806807
}
807808
}

0 commit comments

Comments
 (0)