diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-03-13 10:22:34 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-03-13 10:22:34 +0100 |
commit | b1acc70c26126c7560ff450d5129dee9a6514987 (patch) | |
tree | 18e5120d6aedac31e84ca5f02284178e59354207 | |
parent | b94112ea6c60ed9a4990bcfe4a8ad0a96e90aecd (diff) | |
parent | ed7dd6ddeeea87ccd56be3c83be7dc3942d4ff57 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15
Change-Id: Ia1c7d31c9f5d1fd8dbc33a0357c419301fd67b6a
16 files changed, 180 insertions, 127 deletions
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 695fd670f..f64a8fd73 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -1415,6 +1415,11 @@ </value-type> <object-type name="QLockFile"> <enum-type name="LockError"/> + <modify-function signature="isLocked()const" allow-thread="yes"/> + <modify-function signature="lock()" allow-thread="yes"/> + <modify-function signature="removeStaleLockFile()" allow-thread="yes"/> + <modify-function signature="tryLock(int)" allow-thread="yes"/> + <modify-function signature="unlock()" allow-thread="yes"/> </object-type> <object-type name="QMessageAuthenticationCode"/> <object-type name="QSignalBlocker"/> @@ -1457,12 +1462,13 @@ <object-type name="QThread"> <enum-type name="Priority"/> <modify-function signature="currentThreadId()" remove="all"/> - <modify-function signature="run()" thread="yes"/> + <modify-function signature="run()" allow-thread="yes"/> <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"/> <modify-function signature="usleep(unsigned long)" allow-thread="yes"/> <modify-function signature="wait(unsigned long)" allow-thread="yes"/> + <modify-function signature="yieldCurrentThread()" allow-thread="yes"/> <modify-function signature="start(QThread::Priority)" allow-thread="yes"> <modify-argument index="1"> <rename to="priority"/> @@ -1518,6 +1524,11 @@ <define-ownership class="native" owner="c++"/> </modify-argument> </modify-function> + <modify-function signature="dataChanged(const QModelIndex&,const QModelIndex&,const QVector<int>&)" allow-thread="yes"/> + <modify-function signature="layoutAboutToBeChanged(const QList<QPersistentModelIndex>&,QAbstractItemModel::LayoutChangeHint)" allow-thread="yes"/> + <modify-function signature="layoutChanged(const QList<QPersistentModelIndex>&,QAbstractItemModel::LayoutChangeHint)" allow-thread="yes"/> + <modify-function signature="beginResetModel()" allow-thread="yes"/> + <modify-function signature="endResetModel()" allow-thread="yes"/> </object-type> <value-type name="QItemSelection"> <include file-name="QList" location="global"/> @@ -1718,13 +1729,13 @@ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-receivers"/> </modify-function> - <modify-function signature="destroyed(QObject*)"> + <modify-function signature="destroyed(QObject*)" allow-thread="yes"> <modify-argument index="1"> <rename to="object"/> </modify-argument> </modify-function> - <modify-function signature="sender()const"> + <modify-function signature="sender()const" allow-thread="yes"> <modify-argument index="return"> <define-ownership owner="default"/> </modify-argument> @@ -2202,6 +2213,8 @@ <modify-function signature="flush()" allow-thread="yes"/> </object-type> <object-type name="QFile"> + <modify-function signature="open(QFlags<QIODevice::OpenModeFlag>)" allow-thread="yes"/> + <modify-function signature="open(int,QFlags<QIODevice::OpenModeFlag>,QFlags<QFileDevice::FileHandleFlag>)" allow-thread="yes"/> <modify-function signature="copy(const QString&)" allow-thread="yes"/> <modify-function signature="copy(const QString&,const QString&)" allow-thread="yes"/> <modify-function signature="link(const QString&)" allow-thread="yes"/> @@ -2279,7 +2292,7 @@ <enum-type name="LibraryLocation"/> </object-type> <object-type name="QMutexLocker" copyable="no"> - <modify-function signature="QMutexLocker(QBasicMutex*)" allow-thread="yes"> + <modify-function signature="QMutexLocker(QBasicMutex*)"> <modify-argument index="1"> <reference-count action="set" variable-name="mutex()const0"/> </modify-argument> @@ -2298,23 +2311,24 @@ <!-- Qt5 addition --> <object-type name="QBasicMutex"> - <modify-function signature="lock()" allow-thread="yes"/> - <modify-function signature="tryLock()" allow-thread="yes"/> + <modify-function signature="lock()"/> + <modify-function signature="tryLock()"/> </object-type> <object-type name="QMutex"> <enum-type name="RecursionMode"/> <modify-function signature="lock()" allow-thread="yes"/> + <modify-function signature="unlock()" allow-thread="yes"/> <modify-function signature="tryLock(int)" allow-thread="yes"/> </object-type> <object-type name="QRecursiveMutex" since="5.14"/> <object-type name="QRandomGenerator" since="5.10"> - <modify-function signature="global()" rename="global_" allow-thread="yes"/> + <modify-function signature="global()" rename="global_"/> <modify-function signature="operator()()" remove="all"/> <modify-function signature="generate(quint32*,quint32*)" remove="all"/> </object-type> <object-type name="QRandomGenerator64" since="5.10"> - <modify-function signature="global()" rename="global_" allow-thread="yes"/> + <modify-function signature="global()" rename="global_"/> <modify-function signature="operator()()" remove="all"/> </object-type> <object-type name="QSemaphore"> @@ -2338,7 +2352,9 @@ <extra-includes> <!-- Qt5: private <include file-name="QAbstractFileEngine" location="global"/> --> </extra-includes> - <modify-function signature="createLocalFile(const QString&)" allow-thread="yes"/> + <modify-function signature="createNativeFile(QFile&)" allow-thread="yes"/> + <modify-function signature="createNativeFile(const QString&)" allow-thread="yes"/> + <modify-function signature="open()" allow-thread="yes"/> </object-type> <object-type name="QTemporaryDir"/> <object-type name="QMimeData"> @@ -2385,7 +2401,7 @@ <enum-type name="State"/> </object-type> <object-type name="QTranslator"> - <modify-function signature="load(const uchar*,int,QString)"> + <modify-function signature="load(const uchar*,int,QString)" allow-thread="yes"> <modify-argument index="1"> <replace-type modified-type="PyBuffer"/> </modify-argument> @@ -2778,16 +2794,23 @@ </object-type> <object-type name="QThreadPool"> - <modify-function signature="start(QRunnable*,int)"> + <modify-function signature="clear()" allow-thread="yes"/> + <modify-function signature="activeThreadCount()const" allow-thread="yes"/> + <modify-function signature="releaseThread()" allow-thread="yes"/> + <modify-function signature="reserveThread()" allow-thread="yes"/> + <modify-function signature="setMaxThreadCount(int)" allow-thread="yes"/> + <modify-function signature="waitForDone(int)" allow-thread="yes"/> + <modify-function signature="start(QRunnable*,int)" allow-thread="yes"> <modify-argument index="1"> <parent index="this" action="add"/> </modify-argument> </modify-function> - <modify-function signature="tryStart(QRunnable*)"> + <modify-function signature="tryStart(QRunnable*)" allow-thread="yes"> <modify-argument index="1"> <parent index="this" action="add"/> </modify-argument> </modify-function> + <modify-function signature="tryTake(QRunnable*)" allow-thread="yes"/> <modify-function signature="globalInstance()" > <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="releaseownership"/> @@ -2873,7 +2896,7 @@ </value-type> <value-type name="QMetaEnum"> - <modify-function signature="keyToValue(const char*,bool*)const" allow-thread="yes"> + <modify-function signature="keyToValue(const char*,bool*)const"> <modify-argument index="2"> <remove-argument /> </modify-argument> @@ -2884,7 +2907,7 @@ <insert-template name="fix_args,bool*"/> </inject-code> </modify-function> - <modify-function signature="keysToValue(const char*,bool*)const" allow-thread="yes"> + <modify-function signature="keysToValue(const char*,bool*)const"> <modify-argument index="2"> <remove-argument /> </modify-argument> diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml index e1a170e61..13f8f3cbf 100644 --- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml +++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml @@ -757,6 +757,11 @@ <include file-name="QMatrix" location="global"/> </extra-includes> + <modify-function signature="load(const QString&, const char*)" allow-thread="yes"/> + <modify-function signature="load(QIODevice*,const char*)" allow-thread="yes"/> + <modify-function signature="save(const QString&,const char*,int)const" allow-thread="yes"/> + <modify-function signature="save(QIODevice*,const char*,int)const" allow-thread="yes"/> + <modify-function signature="QImage(uchar*,int,int,int,QImage::Format,QImageCleanupFunction,void*)"> <modify-argument index="1"> <replace-type modified-type="PyBuffer"/> @@ -1214,10 +1219,13 @@ <modify-function signature="drawInlineObject(QPainter*,QRectF,QTextInlineObject,int,QTextFormat)"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> + <modify-function signature="update(const QRectF &)" allow-thread="yes"/> </object-type> <object-type name="QPyTextObject"/> - <object-type name="QDesktopServices" since="4.2"/> + <object-type name="QDesktopServices" since="4.2"> + <modify-function signature="openUrl(const QUrl&)" allow-thread="yes"/> + </object-type> <object-type name="QDoubleValidator"> <enum-type name="Notation"/> </object-type> @@ -1254,6 +1262,8 @@ <parent index="this" action="add"/> </modify-argument> </modify-function> + <modify-function signature="read()" allow-thread="yes"/> + <modify-function signature="write()" allow-thread="yes"/> </object-type> <object-type name="QPixmapCache"> <value-type name="Key"/> @@ -1523,6 +1533,7 @@ <!-- ### This method does not make sense in Python. Update: perhaps it does, but no one is missing it. --> <modify-function signature="read(QImage*)" remove="all"/> + <modify-function signature="read()" allow-thread="yes"/> <modify-function signature="setDevice(QIODevice*)"> <modify-argument index="1"> <parent index="this" action="add"/> @@ -1720,7 +1731,7 @@ <include file-name="QPixmap" location="global"/> </extra-includes> <enum-type name="Mode"/> - <modify-function signature="setMimeData(QMimeData*,QClipboard::Mode)"> + <modify-function signature="setMimeData(QMimeData*,QClipboard::Mode)" allow-thread="yes"> <modify-argument index="1"> <!-- TODO: maybe this is not the best solution --> <parent index="this" action="add"/> @@ -2536,6 +2547,11 @@ </modify-argument> <inject-code file="../glue/qtgui.cpp" snippet="qwindow-fromWinId"/> </modify-function> + <modify-function signature="show()" allow-thread="yes"/> + <modify-function signature="showFullScreen()" allow-thread="yes"/> + <modify-function signature="showMaximized()" allow-thread="yes"/> + <modify-function signature="showMinimized()" allow-thread="yes"/> + <modify-function signature="showNormal()" allow-thread="yes"/> </object-type> <object-type name="QGuiApplication"> @@ -2555,6 +2571,7 @@ <inject-code file="../glue/qtgui.cpp" snippet="qguiapplication-2"/> </add-function> <inject-code class="native" position="beginning" file="../glue/qtgui.cpp" snippet="qguiapplication-init"/> + <modify-function signature="exec()" rename="exec_" allow-thread="yes"/> </object-type> @@ -3017,6 +3034,8 @@ <modify-function signature="advancesForGlyphIndexes(const quint32*,QPointF*,int)const" remove="all"/> <modify-function signature="advancesForGlyphIndexes(const quint32*,QPointF*,int,QFlags<QRawFont::LayoutFlag>)const" remove="all"/> <modify-function signature="glyphIndexesForChars(const QChar*,int,quint32*,int*)const" remove="all"/> + <modify-function signature="loadFromData(const QByteArray&,qreal, QFont::HintingPreference)" allow-thread="yes"/> + <modify-function signature="loadFromFile(const QString&,qreal, QFont::HintingPreference)" allow-thread="yes"/> </value-type> <object-type name="QRasterWindow"/> <object-type name="QScreen"> diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index d9e328f06..2d3761d34 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -444,7 +444,7 @@ <define-ownership class="target" owner="default"/> </modify-argument> </modify-function> - <modify-function signature="setIndexWidget(const QModelIndex &,QWidget*)"> + <modify-function signature="setIndexWidget(const QModelIndex &,QWidget*)" allow-thread="yes"> <modify-argument index="2"> <parent index="this" action="add"/> </modify-argument> @@ -559,6 +559,7 @@ <parent index="return" action="add"/> </modify-argument> </modify-function> + <modify-function signature="registerField(const QString&,QWidget*,const char*,const char*)" allow-thread="yes"/> </object-type> <object-type name="QFocusFrame"> <modify-function signature="setWidget(QWidget*)"> @@ -583,7 +584,7 @@ <insert-template name="bool*_fix,arg"/> </inject-code> </modify-function> - <modify-function signature="getFont(bool*,QFont,QWidget*,QString,QFlags<QFontDialog::FontDialogOption>)"> + <modify-function signature="getFont(bool*,QFont,QWidget*,QString,QFlags<QFontDialog::FontDialogOption>)" allow-thread="yes"> <modify-argument index="1"> <remove-argument /> </modify-argument> @@ -792,15 +793,16 @@ <parent index="this" action="add"/> </modify-argument> </modify-function> + <modify-function signature="removeSubWindow(QWidget*)" allow-thread="yes"/> </object-type> <object-type name="QMdiSubWindow"> <enum-type name="SubWindowOption" flags="SubWindowOptions"/> - <modify-function signature="setWidget(QWidget*)" > + <modify-function signature="setWidget(QWidget*)" allow-thread="yes"> <modify-argument index="1"> <parent index="this" action="add"/> </modify-argument> </modify-function> - <modify-function signature="setSystemMenu(QMenu*)" > + <modify-function signature="setSystemMenu(QMenu*)" allow-thread="yes"> <modify-argument index="1"> <parent index="this" action="add"/> </modify-argument> @@ -1291,16 +1293,16 @@ <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> - <modify-function signature="addWidget(QWidget*)"> + <modify-function signature="addWidget(QWidget*)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> - <modify-function signature="addChildWidget(QWidget*)"> + <modify-function signature="addChildWidget(QWidget*)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> <modify-function signature="addChildLayout(QLayout*)"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> - <modify-function signature="setMenuBar(QWidget*)"> + <modify-function signature="setMenuBar(QWidget*)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> @@ -1341,9 +1343,12 @@ <object-type name="QStackedLayout"> <inject-code class="native" position="beginning" file="../glue/qtwidgets.cpp" snippet="qlayout-help-functions"/> <enum-type name="StackingMode"/> - <modify-function signature="insertWidget(int,QWidget*)"> + <modify-function signature="insertWidget(int,QWidget*)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-2"/> </modify-function> + <modify-function signature="addWidget(QWidget*)" allow-thread="yes"> + <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> + </modify-function> </object-type> <object-type name="QBoxLayout"> @@ -1351,7 +1356,7 @@ <enum-type name="Direction"/> - <modify-function signature="addWidget(QWidget*,int,QFlags<Qt::AlignmentFlag>)"> + <modify-function signature="addWidget(QWidget*,int,QFlags<Qt::AlignmentFlag>)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> @@ -1359,7 +1364,7 @@ <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-1"/> </modify-function> - <modify-function signature="insertWidget(int,QWidget*,int,QFlags<Qt::AlignmentFlag>)"> + <modify-function signature="insertWidget(int,QWidget*,int,QFlags<Qt::AlignmentFlag>)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="addownership-2"/> </modify-function> <modify-function signature="insertLayout(int,QLayout*,int)"> @@ -1759,7 +1764,7 @@ <define-ownership class="target" owner="default"/> </modify-argument> </modify-function> - <modify-function signature="setItemWidget(QTreeWidgetItem*,int,QWidget*)"> + <modify-function signature="setItemWidget(QTreeWidgetItem*,int,QWidget*)" allow-thread="yes"> <modify-argument index="3"> <parent index="this" action="add"/> </modify-argument> @@ -1806,6 +1811,7 @@ <modify-function signature="clear()"> <inject-code file="../glue/qtwidgets.cpp" snippet="qtreewidget-clear"/> </modify-function> + <modify-function signature="removeItemWidget(QTreeWidgetItem*,int)" allow-thread="yes"/> </object-type> <object-type name="QAbstractItemDelegate"> <enum-type name="EndEditHint"/> @@ -1823,13 +1829,14 @@ <define-ownership class="native" owner="c++"/> </modify-argument> </modify-function> + <modify-function signature="closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" allow-thread="yes"/> </object-type> <object-type name="QTableWidgetItem" > <enum-type name="ItemType"/> - <modify-function signature="read(QDataStream&)"> + <modify-function signature="read(QDataStream&)" allow-thread="yes"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> - <modify-function signature="write(QDataStream&)const"> + <modify-function signature="write(QDataStream&)const" allow-thread="yes"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> </object-type> @@ -1855,10 +1862,10 @@ <define-ownership owner="target"/> </modify-argument> </modify-function> - <modify-function signature="read(QDataStream&)"> + <modify-function signature="read(QDataStream&)" allow-thread="yes"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> - <modify-function signature="write(QDataStream&)const"> + <modify-function signature="write(QDataStream&)const" allow-thread="yes"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> </object-type> @@ -1895,10 +1902,10 @@ <object-type name="QTreeWidgetItem" hash-function="qHash"> <enum-type name="ChildIndicatorPolicy"/> <enum-type name="ItemType"/> - <modify-function signature="read(QDataStream&)"> + <modify-function signature="read(QDataStream&)" allow-thread="yes"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> - <modify-function signature="write(QDataStream&)const"> + <modify-function signature="write(QDataStream&)const" allow-thread="yes"> <modify-argument index="1" invalidate-after-use="yes"/> </modify-function> <modify-function signature="QTreeWidgetItem(QTreeWidget*,int)"> @@ -1987,7 +1994,7 @@ <define-ownership class="target" owner="default"/> </modify-argument> </modify-function> - <modify-function signature="setItemWidget(QListWidgetItem*,QWidget*)"> + <modify-function signature="setItemWidget(QListWidgetItem*,QWidget*)" allow-thread="yes"> <modify-argument index="2"> <parent index="1" action="add"/> </modify-argument> @@ -2011,6 +2018,7 @@ <modify-function signature="clear()"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qlistwidget-clear"/> </modify-function> + <modify-function signature="removeItemWidget(QListWidgetItem*)" allow-thread="yes"/> </object-type> <object-type name="QWidget" delete-in-main-thread="true"> @@ -2249,7 +2257,7 @@ </modify-argument> </modify-function> - <modify-function signature="setLayout(QLayout*)"> + <modify-function signature="setLayout(QLayout*)" allow-thread="yes"> <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qwidget-setlayout"/> </modify-function> <modify-function signature="raise()" rename="raise_"/> @@ -2292,7 +2300,8 @@ <modify-function signature="question(QWidget*,const QString&,const QString&,const QString&,const QString&,const QString&,int,int)" remove="all"/> <modify-function signature="warning(QWidget*,const QString&,const QString&,int,int,int)" remove="all"/> <modify-function signature="warning(QWidget*,const QString&,const QString&,const QString&,const QString&,const QString&,int,int)" remove="all"/> - + <modify-function signature="about(QWidget*,const QString&,const QString&)" allow-thread="yes"/> + <modify-function signature="aboutQt(QWidget*,const QString&)" allow-thread="yes"/> </object-type> <object-type name="QAbstractSpinBox"> <enum-type name="ButtonSymbols"/> @@ -2436,7 +2445,7 @@ </modify-function> <modify-function signature="getExistingDirectory(QWidget*,const QString&,const QString&,QFlags<QFileDialog::Option>)" allow-thread="yes"/> - <modify-function signature="getExistingDirectoryUrl(QWidget*,const QString&,const QUrl&,QFlags<QFileDialog::Option>,const QStringList&)"/> + <modify-function signature="getExistingDirectoryUrl(QWidget*,const QString&,const QUrl&,QFlags<QFileDialog::Option>,const QStringList&)" allow-thread="yes"/> <modify-function signature="getOpenFileName(QWidget*,const QString&,const QString&,const QString&,QString*,QFlags<QFileDialog::Option>)" allow-thread="yes"> <modify-argument index="return"> <replace-type modified-type="(fileName, selectedFilter)"/> @@ -2609,11 +2618,12 @@ <parent index="this" action="add"/> </modify-argument> </modify-function> - <modify-function signature="setCellWidget(int,int,QWidget*)"> + <modify-function signature="setCellWidget(int,int,QWidget*)" allow-thread="yes"> <modify-argument index="3"> <parent index="this" action="add"/> </modify-argument> </modify-function> + <modify-function signature="removeCellWidget(int,int)" allow-thread="yes"/> <modify-function signature="setCurrentItem(QTableWidgetItem*)"> <modify-argument index="1"> <parent index="this" action="add"/> @@ -2653,7 +2663,9 @@ </modify-argument> </modify-function> </object-type> - <object-type name="QGroupBox"/> + <object-type name="QGroupBox"> + <modify-function signature="clicked(bool)" allow-thread="yes"/> + </object-type> <object-type name="QStackedWidget"> <modify-function signature="addWidget(QWidget*)"> <modify-argument index="1"> @@ -2939,6 +2951,7 @@ <parent index="this" action="add"/> </modify-argument> </modify-function> + <modify-function signature="triggered(bool)" allow-thread="yes"/> </object-type> <object-type name="QApplication"> @@ -2963,6 +2976,8 @@ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qapplication-setStyle"/> </modify-function> <modify-function signature="exec()" rename="exec_" allow-thread="yes"/> + <modify-function signature="notify(QObject*,QEvent*)" allow-thread="yes"/> + <modify-function signature="alert(QWidget*,int)" allow-thread="yes"/> <inject-code class="native" position="beginning" file="../glue/qtwidgets.cpp" snippet="qapplication-init"/> </object-type> @@ -3235,7 +3250,7 @@ <parent index="1" action="add"/> </modify-argument> </modify-function> - <modify-function signature="setWidget(QWidget*)"> + <modify-function signature="setWidget(QWidget*)" allow-thread="yes"> <inject-code file="../glue/qtwidgets.cpp" snippet="qgraphicsproxywidget-setwidget"/> </modify-function> </object-type> diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index e54fa1846..b870afa55 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -63,10 +63,15 @@ bool py2kStrCheck(PyObject *obj) // defaultValue can also be passed as positional argument, // not only as keyword. QVariant out; -if (kwds || numArgs > 1) +if (kwds || numArgs > 1) { + Py_BEGIN_ALLOW_THREADS out = %CPPSELF.value(%1, %2); -else + Py_END_ALLOW_THREADS +} else { + Py_BEGIN_ALLOW_THREADS out = %CPPSELF.value(%1); + Py_END_ALLOW_THREADS +} PyTypeObject *typeObj = reinterpret_cast<PyTypeObject*>(%PYARG_3); @@ -393,9 +398,7 @@ static bool qobjectConnect(QObject *source, const char *signal, QObject *receive slot++; PySide::SignalManager::registerMetaMethod(receiver, slot, isSignal ? QMetaMethod::Signal : QMetaMethod::Slot); bool connection; - Py_BEGIN_ALLOW_THREADS connection = QObject::connect(source, signal - 1, receiver, slot - 1, type); - Py_END_ALLOW_THREADS return connection; } @@ -451,9 +454,7 @@ static bool qobjectConnectCallback(QObject *source, const char *signal, PyObject } } bool connection; - Py_BEGIN_ALLOW_THREADS connection = QMetaObject::connect(source, signalIndex, receiver, slotIndex, type); - Py_END_ALLOW_THREADS if (connection) { if (usingGlobalReceiver) signalManager.notifyGlobalReceiver(receiver); @@ -499,9 +500,7 @@ static bool qobjectDisconnectCallback(QObject *source, const char *signal, PyObj slotMethod = metaObject->method(slotIndex); bool disconnected; - Py_BEGIN_ALLOW_THREADS disconnected = QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex); - Py_END_ALLOW_THREADS if (disconnected) { if (usingGlobalReceiver) @@ -577,8 +576,10 @@ bool %0 = qobjectConnect(%1, %2, %3, %4, %5); // qFatal doesn't have a stream version, so we do a // qWarning call followed by a qFatal() call using a // literal. +Py_BEGIN_ALLOW_THREADS qWarning() << %1; qFatal("[A qFatal() call was made from Python code]"); +Py_END_ALLOW_THREADS // @snippet qfatal // @snippet moduleshutdown @@ -669,9 +670,7 @@ if (!PyDateTimeAPI) // @snippet qdate-getdate int year, month, day; -%BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(&year, &month, &day); -%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(3); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](year)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](month)); @@ -680,9 +679,7 @@ PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](day)); // @snippet qdate-weeknumber int yearNumber; -%BEGIN_ALLOW_THREADS int week = %CPPSELF.%FUNCTION_NAME(&yearNumber); -%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](week)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](yearNumber)); @@ -1439,7 +1436,10 @@ Py_XINCREF(%PYARG_0); // @snippet qdatastream-readrawdata QByteArray data; data.resize(%2); -int result = %CPPSELF.%FUNCTION_NAME(data.data(), data.size()); +int result = 0; +Py_BEGIN_ALLOW_THREADS +result = %CPPSELF.%FUNCTION_NAME(data.data(), data.size()); +Py_END_ALLOW_THREADS if (result == -1) { Py_INCREF(Py_None); %PYARG_0 = Py_None; @@ -1449,7 +1449,10 @@ if (result == -1) { // @snippet qdatastream-readrawdata // @snippet qdatastream-writerawdata -int r = %CPPSELF.%FUNCTION_NAME(%1, Shiboken::String::len(%PYARG_1)); +int r = 0; +Py_BEGIN_ALLOW_THREADS +r = %CPPSELF.%FUNCTION_NAME(%1, Shiboken::String::len(%PYARG_1)); +Py_END_ALLOW_THREADS %PYARG_0 = %CONVERTTOPYTHON[int](r); // @snippet qdatastream-writerawdata @@ -1580,7 +1583,9 @@ QT_END_NAMESPACE // @snippet use-stream-for-format-security // Uses the stream version for security reasons // see gcc man page at -Wformat-security +Py_BEGIN_ALLOW_THREADS %FUNCTION_NAME() << %1; +Py_END_ALLOW_THREADS // @snippet use-stream-for-format-security // @snippet qresource-registerResource @@ -1594,12 +1599,16 @@ QT_END_NAMESPACE // @snippet qstring-return // @snippet stream-write-method +Py_BEGIN_ALLOW_THREADS (*%CPPSELF) << %1; +Py_END_ALLOW_THREADS // @snippet stream-write-method // @snippet stream-read-method %RETURN_TYPE _cpp_result; +Py_BEGIN_ALLOW_THREADS (*%CPPSELF) >> _cpp_result; +Py_END_ALLOW_THREADS %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](_cpp_result); // @snippet stream-read-method @@ -1621,7 +1630,9 @@ if (PyBytes_Check(%PYARG_0)) { // @snippet qiodevice-readData QByteArray ba(1 + int(%2), char(0)); +Py_BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(ba.data(), int(%2)); +Py_END_ALLOW_THREADS %PYARG_0 = Shiboken::String::fromCString(ba.constData()); // @snippet qiodevice-readData diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp index d2480e99e..a6b45b7c0 100644 --- a/sources/pyside2/PySide2/glue/qtgui.cpp +++ b/sources/pyside2/PySide2/glue/qtgui.cpp @@ -78,9 +78,7 @@ QBitmap %0 = QBitmap::fromData(%1, buffer, %3); // @snippet qbitmap-fromdata // @snippet qtextline-cursortox -%BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2); -%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1)); @@ -444,9 +442,7 @@ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1)); // @snippet qclipboard-text // @snippet qpainter-drawpolygon -%BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); -%END_ALLOW_THREADS // @snippet qpainter-drawpolygon // @snippet qmatrix-map-point diff --git a/sources/pyside2/PySide2/glue/qtwidgets.cpp b/sources/pyside2/PySide2/glue/qtwidgets.cpp index 0e0b025a6..1c663364c 100644 --- a/sources/pyside2/PySide2/glue/qtwidgets.cpp +++ b/sources/pyside2/PySide2/glue/qtwidgets.cpp @@ -93,18 +93,14 @@ _defaultValue = %PYARG_1; // @snippet qformlayout-fix-args int _row; QFormLayout::ItemRole _role; -%BEGIN_ALLOW_THREADS %CPPSELF->%FUNCTION_NAME(%ARGUMENT_NAMES, &_row, &_role); -%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](_row)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QFormLayout::ItemRole](_role)); // @snippet qformlayout-fix-args // @snippet qfiledialog-return -%BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &%5, %6); -%END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG5_TYPE](%5)); @@ -389,9 +385,7 @@ Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem *](parentItem)); const auto &childItems = %1->childItems(); for (auto *item : childItems) Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem *](item)); -%BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1); -%END_ALLOW_THREADS // the arg was destroyed by Qt. Shiboken::Object::invalidate(%PYARG_1); // @snippet qgraphicsscene-destroyitemgroup diff --git a/sources/pyside2/PySide2/templates/core_common.xml b/sources/pyside2/PySide2/templates/core_common.xml index 8147b39e8..6d02428ad 100644 --- a/sources/pyside2/PySide2/templates/core_common.xml +++ b/sources/pyside2/PySide2/templates/core_common.xml @@ -49,17 +49,13 @@ <template name="bool*_fix,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2); - %END_ALLOW_THREADS <insert-template name="tuple_ok_retval"/> </template> <template name="bool*_fix,arg,arg,arg,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4, %5); - %END_ALLOW_THREADS <insert-template name="tuple_ok_retval"/> </template> @@ -72,113 +68,85 @@ <template name="fix_bool*"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_args,bool*"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &ok_); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_args,arg,bool*"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &ok_); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_arg,bool*,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, &ok_, %3); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_bool*,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_bool*,arg,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_bool*,arg,arg,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_bool*,arg,arg,arg,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&ok_, %2, %3, %4, %5); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &ok_, %9); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, &ok_, %9, %10); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_arg,arg,arg,arg,arg,arg,bool*,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, &ok_, %8); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_arg,arg,arg,arg,arg,bool*,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, &ok_, %7); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_arg,arg,arg,arg,bool*,arg,arg"> bool ok_; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, &ok_, %6, %7); - %END_ALLOW_THREADS <insert-template name="tuple_retval_ok"/> </template> <template name="fix_char*"> char val_{}; - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&val_); - %END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[char](val_)); @@ -194,17 +162,13 @@ <template name="fix_number*,number*,number*,number*"> $TYPE a, b, c, d; - %BEGIN_ALLOW_THREADS %CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d); - %END_ALLOW_THREADS <insert-template name="tuple_abcd_same_type"/> </template> <template name="fix_number*,number*,number*,number*,args"> $TYPE a, b, c, d; - %BEGIN_ALLOW_THREADS %CPPSELF->::%TYPE::%FUNCTION_NAME(&a, &b, &c, &d, %ARGUMENT_NAMES); - %END_ALLOW_THREADS <insert-template name="tuple_abcd_same_type"/> </template> @@ -227,9 +191,7 @@ <template name="fix_number*,number*,number*,number*,number*"> $TYPE a, b, c, d, e; - %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d, &e); - %END_ALLOW_THREADS %PYARG_0 = PyTuple_New(5); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b)); @@ -240,9 +202,7 @@ <template name="fix_args,number*,number*"> $TYPE a, b; - %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &a, &b); - %END_ALLOW_THREADS %PYARG_0 = PyTuple_New(2); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[$TYPE](a)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[$TYPE](b)); @@ -251,9 +211,7 @@ <template name="fix_arg,int*,int*"> %RETURN_TYPE _ret; int a, b; - %BEGIN_ALLOW_THREADS _ret = %CPPSELF.%FUNCTION_NAME(%1, &a, &b); - %END_ALLOW_THREADS %PYARG_0 = PyTuple_New(3); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](_ret)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](a)); @@ -261,9 +219,7 @@ </template> <template name="return_tuple_QValidator_QString_int"> - %BEGIN_ALLOW_THREADS %RETURN_TYPE retval_ = %RETURN_TYPE(%CPPSELF.%FUNCTION_NAME(%1, %2)); - %END_ALLOW_THREADS %PYARG_0 = PyTuple_New(3); PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_)); PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1)); diff --git a/sources/pyside2/PySide2/templates/gui_common.xml b/sources/pyside2/PySide2/templates/gui_common.xml index 96b4906ef..a139a5fe9 100644 --- a/sources/pyside2/PySide2/templates/gui_common.xml +++ b/sources/pyside2/PySide2/templates/gui_common.xml @@ -66,9 +66,7 @@ for (int line = 0; line < lineCount; ++line) xpm[line] = Shiboken::String::toCString(PySequence_Fast_GET_ITEM(strList.object(), line)); - %BEGIN_ALLOW_THREADS %0 = new %TYPE(xpm); - %END_ALLOW_THREADS free(xpm); </template> @@ -164,9 +162,7 @@ </template> <template name="qpainter_drawlist"> - %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size()); - %END_ALLOW_THREADS </template> <template name="inplace_add"> @@ -255,17 +251,13 @@ <template name="fix_args,QRectF*"> QRectF rect_; - %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &rect_); - %END_ALLOW_THREADS %PYARG_0 = %CONVERTTOPYTHON[QRectF](rect_); </template> <template name="fix_args,QRect*"> QRect rect_; - %BEGIN_ALLOW_THREADS %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &rect_); - %END_ALLOW_THREADS %PYARG_0 = %CONVERTTOPYTHON[QRect](rect_); </template> diff --git a/sources/pyside2/PySide2/templates/openglfunctions_common.xml b/sources/pyside2/PySide2/templates/openglfunctions_common.xml index e01094004..117229a29 100644 --- a/sources/pyside2/PySide2/templates/openglfunctions_common.xml +++ b/sources/pyside2/PySide2/templates/openglfunctions_common.xml @@ -41,10 +41,8 @@ --> <typesystem> <template name="glGetString_return_QString"> - %BEGIN_ALLOW_THREADS const GLubyte *us = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES); const QString s = QString::fromLocal8Bit(reinterpret_cast<const char *>(us)); - %END_ALLOW_THREADS %PYARG_0 = %CONVERTTOPYTHON[QString](s); </template> </typesystem> diff --git a/sources/pyside2/libpyside/dynamicqmetaobject.cpp b/sources/pyside2/libpyside/dynamicqmetaobject.cpp index 2c5a0ee05..51e6598b3 100644 --- a/sources/pyside2/libpyside/dynamicqmetaobject.cpp +++ b/sources/pyside2/libpyside/dynamicqmetaobject.cpp @@ -413,6 +413,10 @@ const QMetaObject *MetaObjectBuilderPrivate::update() if (!m_builder) return m_baseObject; if (m_cachedMetaObjects.empty() || m_dirty) { + // PYSIDE-803: The dirty branch needs to be protected by the GIL. + // This was moved from SignalManager::retrieveMetaObject to here, + // which is only the update in "return builder->update()". + Shiboken::GilState gil; m_cachedMetaObjects.push_back(m_builder->toMetaObject()); checkMethodOrder(m_cachedMetaObjects.back()); m_dirty = false; diff --git a/sources/pyside2/libpyside/signalmanager.cpp b/sources/pyside2/libpyside/signalmanager.cpp index c21a3e565..01b347a3d 100644 --- a/sources/pyside2/libpyside/signalmanager.cpp +++ b/sources/pyside2/libpyside/signalmanager.cpp @@ -550,6 +550,12 @@ bool SignalManager::registerMetaMethod(QObject *source, const char *signature, Q static MetaObjectBuilder *metaBuilderFromDict(PyObject *dict) { + // PYSIDE-803: The dict in this function is the ob_dict of an SbkObject. + // The "metaObjectAttr" entry is only handled in this file. There is no + // way in this function to involve the interpreter. Therefore, we need + // no GIL. + // Note that "SignalManager::registerMetaMethodGetIndex" has write actions + // that might involve the interpreter, but in that context the GIL is held. if (!dict || !PyDict_Contains(dict, metaObjectAttr)) return nullptr; @@ -605,7 +611,14 @@ int SignalManager::registerMetaMethodGetIndex(QObject *source, const char *signa const QMetaObject *SignalManager::retrieveMetaObject(PyObject *self) { - Shiboken::GilState gil; + // PYSIDE-803: Avoid the GIL in SignalManager::retrieveMetaObject + // This function had the GIL. We do not use the GIL unless we have to. + // metaBuilderFromDict accesses a Python dict, but in that context there + // is no way to reach the interpreter, see "metaBuilderFromDict". + // + // The update function is MetaObjectBuilderPrivate::update in + // dynamicmetaobject.c . That function now uses the GIL when the + // m_dirty flag is set. Q_ASSERT(self); MetaObjectBuilder *builder = metaBuilderFromDict(reinterpret_cast<SbkObject *>(self)->ob_dict); diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index e6590e2dc..00031ab5d 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -814,9 +814,11 @@ bool AbstractMetaFunction::allowThread() const case TypeSystem::AllowThread::Allow: break; case TypeSystem::AllowThread::Auto: - case TypeSystem::AllowThread::Unspecified: result = autoDetectAllowThread(); break; + case TypeSystem::AllowThread::Unspecified: + result = false; + break; } if (!result) qCDebug(lcShiboken).noquote() << msgDisallowThread(this); diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp index c87dd0174..4a69948da 100644 --- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp @@ -393,6 +393,33 @@ void TypeInfo::simplifyStdType() } } +void TypeInfo::formatTypeSystemSignature(QTextStream &str) const +{ + if (m_constant) + str << "const "; + str << m_qualifiedName.join(QLatin1String("::")); + switch (m_referenceType) { + case NoReference: + break; + case LValueReference: + str << '&'; + break; + case RValueReference: + str << "&&"; + break; + } + for (auto i : m_indirections) { + switch (i) { + case Indirection::Pointer: + str << '*'; + break; + case Indirection::ConstPointer: + str << "* const"; + break; + } + } +} + #ifndef QT_NO_DEBUG_STREAM template <class It> void formatSequence(QDebug &d, It i1, It i2, const char *separator=", ") @@ -1145,7 +1172,7 @@ QString _FunctionModelItem::typeSystemSignature() const // For dumping out type for (int a = 0, size = m_arguments.size(); a < size; ++a) { if (a) str << ','; - str << m_arguments.at(a)->type().qualifiedName().join(QLatin1String("::")); + m_arguments.at(a)->type().formatTypeSystemSignature(str); } str << ')'; return result; diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h index 028dbc7e4..cfe2e055c 100644 --- a/sources/shiboken2/ApiExtractor/parser/codemodel.h +++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h @@ -202,6 +202,8 @@ public: static TypeInfo combine(const TypeInfo &__lhs, const TypeInfo &__rhs); static TypeInfo resolveType(TypeInfo const &__type, const ScopeModelItem &__scope); + void formatTypeSystemSignature(QTextStream &str) const; + #ifndef QT_NO_DEBUG_STREAM void formatDebug(QDebug &d) const; #endif diff --git a/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp b/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp index 922f1c23f..4fd4269f6 100644 --- a/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp @@ -256,9 +256,9 @@ struct A { // Nothing specified, true const AbstractMetaFunction *f1 = classA->findFunction(QLatin1String("f1")); QVERIFY(f1); - QVERIFY(f1->allowThread()); + QVERIFY(!f1->allowThread()); - // 'auto' specified, should be true for nontrivial function + // 'auto' specified, should be false for nontrivial function const AbstractMetaFunction *f2 = classA->findFunction(QLatin1String("f2")); QVERIFY(f2); QVERIFY(f2->allowThread()); @@ -349,7 +349,7 @@ struct A : public Base { <object-type name='A'/> </typesystem>)XML") << false << false << false // exception - << true; // allowthread + << false; // allowthread // Modify one function QTest::newRow("modify-function1") @@ -363,7 +363,7 @@ struct A : public Base { </object-type> </typesystem>)XML") << false << false << true // exception - << true; // allowthread + << false; // allowthread // Flip defaults by modifying functions QTest::newRow("modify-function2") @@ -378,7 +378,7 @@ struct A : public Base { </object-type> </typesystem>)XML") << true << false << false // exception - << true; // allowthread + << false; // allowthread // Activate on type system level QTest::newRow("typesystem-on") @@ -428,7 +428,7 @@ struct A : public Base { </object-type> </typesystem>)XML") << true << false << false // exception - << true; // allowthread + << false; // allowthread } void TestModifyFunction::testScopedModifications() diff --git a/sources/shiboken2/doc/typesystem_manipulating_objects.rst b/sources/shiboken2/doc/typesystem_manipulating_objects.rst index c04a4fa27..f76289bc4 100644 --- a/sources/shiboken2/doc/typesystem_manipulating_objects.rst +++ b/sources/shiboken2/doc/typesystem_manipulating_objects.rst @@ -119,6 +119,7 @@ modify-function lengthy I/O operations or similar. It has performance costs, though. The value ``auto`` means that it will be turned off for functions for which it is deemed to be safe, for example, simple getters. + The attribute defaults to ``false``. The ``exception-handling`` attribute specifies whether to generate exception handling code (nest the function call into try / catch statements). It accepts |