Fixing a bug where the cached doxygen docstring could be deleted while still in use, causing swig to segfault

This commit is contained in:
Alec Woods 2019-01-25 20:07:57 -05:00
commit e150d58092
2 changed files with 8 additions and 0 deletions

View file

@ -18,6 +18,9 @@ Version 4.0.0 (in progress)
Only show a single documentation entry for functions with default arguments when
using autodoc.
Fixed a bug where a cached doxygen docstring could be deleted while still in use,
causing swig to segfault.
2019-01-22: vadz
[Ruby, Octave] #1424 Improve autodoc parameter naming.

View file

@ -1571,6 +1571,11 @@ public:
// depends on the comment which is not going to change, so we can
// safely cache it.
Setattr(n, "python:docstring", Copy(docstr));
} else {
// Must copy here since if the docstring is multi-line, the String*
// here will get Deleted below, which is bad if it is a pointer to
// the cached object!
docstr = Copy(docstr);
}
}
}