diff options
author | Christian Tismer <tismer@stackless.com> | 2019-06-09 17:13:28 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-06-10 15:14:19 +0200 |
commit | 6108df521065e3a4628ae5656c3cbfd281b6765d (patch) | |
tree | 64308d61760d13db079b1f360788aa0a19627315 /sources | |
parent | f54fc43bb466cb588cdb47edd08a86979d5b4e90 (diff) |
Fix negative refcount on QSocketNotifier
Change 43451e3bc17467593df64cb73ce8c0bf9e60045f from 2018-05-09
introduced a refcount bug that was not caught because we do not
build with debug Python.
This also revealed an omission in the patch
"PySide: Allow any existing attribute in the constructor"
when debug Python is used.
Change-Id: Idbcbbc87f0a83bb696d03e05af0cf616b21f7335
Fixes: PYSIDE-1027
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside2/PySide2/glue/qtcore.cpp | 4 | ||||
-rw-r--r-- | sources/pyside2/libpyside/pyside.cpp | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index fde016548..f30607f6b 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -1211,8 +1211,8 @@ QByteArray ba(1 + int(%2), char(0)); // @snippet qcryptographichash-adddata // @snippet qsocketnotifier -Shiboken::AutoDecRef socket(%PYARG_1); -if (!socket.isNull()) { +PyObject *socket = %PYARG_1; +if (socket != nullptr) { // We use qintptr as PyLong, but we check for int // since it is currently an alias to be Python2 compatible. // Internally, ints are qlonglongs. diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index 170a3587f..fff28a9e7 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -108,6 +108,7 @@ static bool _setProperty(PyObject* qObj, PyObject *name, PyObject *value, bool * if (retval.isNull()) return false; } else { + PyErr_Clear(); Shiboken::AutoDecRef attr(PyObject_GenericGetAttr(qObj, name)); if (PySide::Property::checkType(attr)) { *accept = true; |