aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/glue
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-11-26 19:19:05 +0100
committerCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-11-28 16:59:41 +0100
commit6554f407beaaa988a1d59eb7eee4766376bad18c (patch)
tree1238c1ee2883eb60c9d05ebcdf043cc2ff9cc7e3 /sources/pyside2/PySide2/glue
parentdd772392f52f2bed8eb937f375692114d2acbac7 (diff)
Fix refcount issues with QSettings glue code
Task-number: PYSIDE-939 Change-Id: I5bda4e2025e31bf192bf0bf70c82aa626cd19714 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/PySide2/glue')
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 47b3dd6db..8bcc315b2 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -81,7 +81,6 @@ if (typeObj) {
for (int i = 0; i < valuesSize; i++) {
PyObject *item = PyUnicode_FromString(valuesList[i].data());
PyList_SET_ITEM(list, i, item);
- Py_DECREF(item);
}
%PYARG_0 = list;
@@ -110,15 +109,23 @@ if (typeObj) {
float asFloat = out.toFloat();
%PYARG_0 = PyFloat_FromDouble(asFloat);
} else if (typeObj == &PyBool_Type) {
- %PYARG_0 = out.toBool() ? Py_True : Py_False;
+ if (out.toBool()) {
+ Py_INCREF(Py_True);
+ %PYARG_0 = Py_True;
+ } else {
+ Py_INCREF(Py_False);
+ %PYARG_0 = Py_False;
+ }
}
// TODO: PyDict_Type and PyTuple_Type
}
else {
- if (!out.isValid())
+ if (!out.isValid()) {
+ Py_INCREF(Py_None);
%PYARG_0 = Py_None;
- else
+ } else {
%PYARG_0 = %CONVERTTOPYTHON[QVariant](out);
+ }
}
// @snippet qsettings-value