[Bf-blender-cvs] [c4b5279bbca] blender-v2.82-release: Fix T72894: Mantaflow: several crashes due to null pointers

Sebastián Barschkis noreply at git.blender.org
Wed Jan 22 11:18:11 CET 2020


Commit: c4b5279bbca4db2ee88e0451fe6d41175e26719a
Author: Sebastián Barschkis
Date:   Wed Jan 22 11:17:34 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBc4b5279bbca4db2ee88e0451fe6d41175e26719a

Fix T72894: Mantaflow: several crashes due to null pointers

Incorporated LazyDodo's suggestions from the task.

===================================================================

M	intern/mantaflow/intern/MANTA_main.cpp

===================================================================

diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp
index 79363126aff..a1851da711a 100644
--- a/intern/mantaflow/intern/MANTA_main.cpp
+++ b/intern/mantaflow/intern/MANTA_main.cpp
@@ -2057,7 +2057,10 @@ static char *pyObjectToString(PyObject *inputObject)
 
   PyObject *encoded = PyUnicode_AsUTF8String(inputObject);
   char *result = PyBytes_AsString(encoded);
-  Py_DECREF(encoded);
+
+  /* Do not decref (i.e. Py_DECREF(encoded)) of string 'encoded' PyObject.
+   * Otherwise those objects will be invalidated too early (see T72894).
+   * Reference count of those Python objects will be decreased with 'del' in Python scripts. */
   Py_DECREF(inputObject);
 
   PyGILState_Release(gilstate);



More information about the Bf-blender-cvs mailing list