diff --git a/CHANGES.current b/CHANGES.current index 2b41c50c6..6edffb78b 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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. diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index e2206b067..b6a8e5d79 100755 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -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); } } }