aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/autodecref.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-25 16:33:12 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-05-25 16:33:12 +0200
commit39ac266455cc1c0ae970a47c34d3a6bc7372d750 (patch)
tree9577fe06bcb0e3096ef85af929a91eb37b037452 /sources/shiboken2/libshiboken/autodecref.h
parent9115712ef3a1be8b401c9cd306792dbc30c89bf0 (diff)
parent6717d3540fac74c91d9381958a08e60f6532d402 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.14.2
Diffstat (limited to 'sources/shiboken2/libshiboken/autodecref.h')
-rw-r--r--sources/shiboken2/libshiboken/autodecref.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/shiboken2/libshiboken/autodecref.h b/sources/shiboken2/libshiboken/autodecref.h
index d3353b1e4..498b1aec4 100644
--- a/sources/shiboken2/libshiboken/autodecref.h
+++ b/sources/shiboken2/libshiboken/autodecref.h
@@ -96,8 +96,10 @@ public:
*/
void reset(PyObject *other)
{
- Py_XDECREF(m_pyObj);
+ // Safely decref m_pyObj. See Py_XSETREF in object.h .
+ PyObject *_py_tmp = m_pyObj;
m_pyObj = other;
+ Py_XDECREF(_py_tmp);
}
private:
PyObject *m_pyObj;