Fix issue with iterating actions via previous/next in python

* We keep parent references when returning child objects via reference/python
  object wrappers rather than copying. But when iterating a linked list like the
  actions this can produce an incredibly long parent chain and then on
  destruction we can stack overflow if the chain is long enough.
This commit is contained in:
baldurk
2024-12-03 14:34:11 +00:00
parent 8d04479d20
commit d37b0ee00b
+15
View File
@@ -214,6 +214,21 @@ VA_IGNORE_REST_OF_FILE
$1.assign(*$input);
}
%typemap(ret) const ActionDescription * {
// for ActionDescription pointers don't apply parent tracking, since these are preserved
// in other ways and the linked-list nature of walking them can produce absurdly long
// parent chains
if (SwigPyObject_Check($result))
{
SwigPyObject *sobj = (SwigPyObject *)$result;
if(sobj->parent)
{
sobj->parent = NULL;
Py_DECREF($self);
}
}
}
SIMPLE_TYPEMAPS(rdcstr)
SIMPLE_TYPEMAPS(rdcinflexiblestr)
SIMPLE_TYPEMAPS(rdcdatetime)