aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-02 15:18:12 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-07-02 15:18:12 +0200
commit08b0fd0bca56c8a6c7fb0b4ca3837e800b98736d (patch)
tree8cc07ff2cced7e253f0605927ee5c2143d0ca4cf /sources
parent023fc0b747460b0e4f30d5b38961bb53dcfdde3c (diff)
parentbdb6f68fd65537d6bd3f6e2e896a8471a81a9279 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.14.2
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml8
-rw-r--r--sources/pyside2/PySide2/__init__.py.in3
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp28
-rw-r--r--sources/pyside2/PySide2/glue/qtuitools.cpp11
-rw-r--r--sources/pyside2/libpyside/pyside.cpp1
-rw-r--r--sources/shiboken2/generator/main.cpp2
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp2
-rw-r--r--sources/shiboken2/libshiboken/gilstate.cpp7
-rw-r--r--sources/shiboken2/libshiboken/gilstate.h1
-rw-r--r--sources/shiboken2/tests/libsample/pen.cpp4
-rw-r--r--sources/shiboken2/tests/libsample/pen.h5
-rw-r--r--sources/shiboken2/tests/samplebinding/pen_test.py2
-rw-r--r--sources/shiboken2/tests/samplebinding/typesystem_sample.xml1
13 files changed, 67 insertions, 8 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 26193a0aa..8294947ed 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -1460,9 +1460,15 @@
<enum-type name="IteratorFlag" flags="IteratorFlags"/>
</object-type>
<object-type name="QThread">
+ <inject-code file="../glue/qtcore.cpp" class="native" position="beginning" snippet="qthread_pthread_cleanup"/>
<enum-type name="Priority"/>
<modify-function signature="currentThreadId()" remove="all"/>
- <modify-function signature="run()" allow-thread="yes"/>
+ <modify-function signature="run()" allow-thread="yes">
+ <inject-code file="../glue/qtcore.cpp" class="native" position="beginning"
+ snippet="qthread_pthread_cleanup_install"/>
+ <inject-code file="../glue/qtcore.cpp" class="native" position="end"
+ snippet="qthread_pthread_cleanup_uninstall"/>
+ </modify-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
<modify-function signature="msleep(unsigned long)" allow-thread="yes"/>
<modify-function signature="sleep(unsigned long)" allow-thread="yes"/>
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in
index 8013ac68a..f860c6ac9 100644
--- a/sources/pyside2/PySide2/__init__.py.in
+++ b/sources/pyside2/PySide2/__init__.py.in
@@ -12,6 +12,9 @@ __version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @B
def _additional_dll_directories(package_dir):
# Find shiboken2 relative to the package directory.
root = os.path.dirname(package_dir)
+ # Check for a flat .zip as deployed by cx_free(PYSIDE-1257)
+ if root.endswith('.zip'):
+ return []
shiboken2 = os.path.join(root, 'shiboken2')
if os.path.isdir(shiboken2): # Standard case, only shiboken2 is needed
return [shiboken2]
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 111e324b9..41ee743e7 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -1960,3 +1960,31 @@ PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first));
PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second));
return %out;
// @snippet return-qpair
+
+// @snippet qthread_pthread_cleanup
+#ifdef Q_OS_UNIX
+# include <stdio.h>
+# include <pthread.h>
+static void qthread_pthread_cleanup(void *arg)
+{
+ // PYSIDE 1282: When terminating a thread using QThread::terminate()
+ // (pthread_cancel()), QThread::run() is aborted and the lock is released,
+ // but ~GilState() is still executed for some reason. Prevent it from
+ // releasing.
+ auto gil = reinterpret_cast<Shiboken::GilState *>(arg);
+ gil->abandon();
+}
+#endif // Q_OS_UNIX
+// @snippet qthread_pthread_cleanup
+
+// @snippet qthread_pthread_cleanup_install
+#ifdef Q_OS_UNIX
+pthread_cleanup_push(qthread_pthread_cleanup, &gil);
+#endif
+// @snippet qthread_pthread_cleanup_install
+
+// @snippet qthread_pthread_cleanup_uninstall
+#ifdef Q_OS_UNIX
+pthread_cleanup_pop(0);
+#endif
+// @snippet qthread_pthread_cleanup_uninstall
diff --git a/sources/pyside2/PySide2/glue/qtuitools.cpp b/sources/pyside2/PySide2/glue/qtuitools.cpp
index 668b512e4..d81f6205a 100644
--- a/sources/pyside2/PySide2/glue/qtuitools.cpp
+++ b/sources/pyside2/PySide2/glue/qtuitools.cpp
@@ -137,16 +137,19 @@ if (uiFileName.isEmpty()) {
Py_RETURN_NONE;
}
-QString uicBin("uic");
-QStringList uicArgs = {"-g", "python", QString::fromUtf8(uiFileName)};
+// Use the 'pyside2-uic' wrapper instead of 'uic'
+// This approach is better than rely on 'uic' since installing
+// the wheels cover this case.
+QString uicBin("pyside2-uic");
+QStringList uicArgs = {QString::fromUtf8(uiFileName)};
QProcess uicProcess;
uicProcess.start(uicBin, uicArgs);
if (!uicProcess.waitForFinished()) {
- qCritical() << "Cannot run 'uic': " << uicProcess.errorString() << " - "
+ qCritical() << "Cannot run 'pyside2-uic': " << uicProcess.errorString() << " - "
<< "Exit status " << uicProcess.exitStatus()
<< " (" << uicProcess.exitCode() << ")\n"
- << "Check if 'uic' is in PATH";
+ << "Check if 'pyside2-uic' is in PATH";
Py_RETURN_NONE;
}
QByteArray uiFileContent = uicProcess.readAllStandardOutput();
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp
index d22958398..e2b8708ce 100644
--- a/sources/pyside2/libpyside/pyside.cpp
+++ b/sources/pyside2/libpyside/pyside.cpp
@@ -328,7 +328,6 @@ PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *nam
Py_DECREF(attr);
if (!value)
return 0;
- Py_INCREF(value);
attr = value;
}
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index 25daea99e..7c9ce4fb2 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -41,7 +41,7 @@
#include "headergenerator.h"
#include "qtdocgenerator.h"
-#ifdef _WINDOWS
+#ifdef Q_OS_WIN
static const QChar pathSplitter = QLatin1Char(';');
#else
static const QChar pathSplitter = QLatin1Char(':');
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index b7852c017..b6ab70d1f 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -589,7 +589,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction
{
QString value = arg->defaultValueExpression();
- if (value.isEmpty()
+ if (value.isEmpty() || value == QLatin1String("{}")
|| arg->hasModifiedDefaultValueExpression()
|| isPointer(arg->type())) {
return value;
diff --git a/sources/shiboken2/libshiboken/gilstate.cpp b/sources/shiboken2/libshiboken/gilstate.cpp
index a59c6f01e..76a4d0e61 100644
--- a/sources/shiboken2/libshiboken/gilstate.cpp
+++ b/sources/shiboken2/libshiboken/gilstate.cpp
@@ -63,5 +63,12 @@ void GilState::release()
}
}
+// Abandon the lock: Only for special situations, like termination of a
+// POSIX thread (PYSIDE 1282).
+void GilState::abandon()
+{
+ m_locked = false;
+}
+
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/gilstate.h b/sources/shiboken2/libshiboken/gilstate.h
index d22f688ba..fbf39ead0 100644
--- a/sources/shiboken2/libshiboken/gilstate.h
+++ b/sources/shiboken2/libshiboken/gilstate.h
@@ -57,6 +57,7 @@ public:
GilState();
~GilState();
void release();
+ void abandon();
private:
PyGILState_STATE m_gstate;
bool m_locked = false;
diff --git a/sources/shiboken2/tests/libsample/pen.cpp b/sources/shiboken2/tests/libsample/pen.cpp
index d30071f49..b08721f79 100644
--- a/sources/shiboken2/tests/libsample/pen.cpp
+++ b/sources/shiboken2/tests/libsample/pen.cpp
@@ -65,3 +65,7 @@ int Pen::ctorType()
{
return m_ctor;
}
+
+void Pen::drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints)
+{
+}
diff --git a/sources/shiboken2/tests/libsample/pen.h b/sources/shiboken2/tests/libsample/pen.h
index ca079198b..6b3bf9f1a 100644
--- a/sources/shiboken2/tests/libsample/pen.h
+++ b/sources/shiboken2/tests/libsample/pen.h
@@ -49,11 +49,16 @@ class LIBSAMPLE_API Pen
public:
enum { EmptyCtor, EnumCtor, ColorCtor, CopyCtor };
+ enum RenderHints { None = 0, Antialiasing = 0x1, TextAntialiasing = 0x2 };
+
Pen();
Pen(SampleNamespace::Option option);
Pen(const Color& color);
Pen(const Pen& pen);
+ // PYSIDE-1325, default initializer
+ void drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints = {});
+
int ctorType();
private:
int m_ctor;
diff --git a/sources/shiboken2/tests/samplebinding/pen_test.py b/sources/shiboken2/tests/samplebinding/pen_test.py
index 408871bb3..89abf4d54 100644
--- a/sources/shiboken2/tests/samplebinding/pen_test.py
+++ b/sources/shiboken2/tests/samplebinding/pen_test.py
@@ -63,6 +63,8 @@ class TestPen(unittest.TestCase):
def testPenWithIntConvertedToColor(self):
pen = Pen(1)
self.assertEqual(pen.ctorType(), Pen.ColorCtor)
+ pen.drawLine(0, 0, 5, 5)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
index 30ad5def7..3aaecf247 100644
--- a/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
+++ b/sources/shiboken2/tests/samplebinding/typesystem_sample.xml
@@ -2310,6 +2310,7 @@
<value-type name="Color" />
<value-type name="Pen">
<enum-type identified-by-value="EnumCtor"/>
+ <enum-type name="RenderHints"/>
</value-type>
<value-type name="CtorConvRule">