diff options
Diffstat (limited to 'sources')
-rw-r--r-- | sources/pyside2/PySide2/QtGui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml | 19 | ||||
-rw-r--r-- | sources/pyside2/PySide2/glue/qtgui.cpp | 10 | ||||
-rw-r--r-- | sources/pyside2/PySide2/templates/gui_common.xml | 5 | ||||
-rw-r--r-- | sources/pyside2/pyside_version.py | 2 | ||||
-rw-r--r-- | sources/pyside2/tests/QtCore/snake_prop_feature_test.py | 2 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/signature/signature.cpp | 2 | ||||
-rw-r--r-- | sources/shiboken2/shiboken_version.py | 2 | ||||
-rw-r--r-- | sources/shiboken2/shibokenmodule/files.dir/shibokensupport/feature.py | 11 |
9 files changed, 40 insertions, 15 deletions
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt index c4a38a184..88d8be93f 100644 --- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt @@ -100,7 +100,7 @@ ${QtGui_GEN_DIR}/qopengldebugmessage_wrapper.cpp ${QtGui_GEN_DIR}/qopenglextrafunctions_wrapper.cpp ${QtGui_GEN_DIR}/qopenglframebufferobjectformat_wrapper.cpp ${QtGui_GEN_DIR}/qopenglfunctions_wrapper.cpp -# Compile error on Windows: ${QtGui_GEN_DIR}/qopenglpaintdevice_wrapper.cpp +${QtGui_GEN_DIR}/qopenglpaintdevice_wrapper.cpp ${QtGui_GEN_DIR}/qopenglpixeltransferoptions_wrapper.cpp ${QtGui_GEN_DIR}/qopenglshaderprogram_wrapper.cpp ${QtGui_GEN_DIR}/qopengltexture_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml index b0c61fe64..e66ee48ce 100644 --- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml +++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml @@ -643,6 +643,16 @@ <define-ownership class="target" owner="default"/> </modify-argument> </modify-function> + <modify-function signature="currentTable()const"> + <modify-argument index="return"> + <define-ownership class="target" owner="default"/> + </modify-argument> + </modify-function> + <modify-function signature="currentList()const"> + <modify-argument index="return"> + <define-ownership class="target" owner="default"/> + </modify-argument> + </modify-function> <modify-function signature="insertTable(int,int,const QTextTableFormat &)"> <modify-argument index="return"> <define-ownership class="target" owner="default"/> @@ -758,6 +768,8 @@ <include file-name="QStringList" location="global"/> <include file-name="QMatrix" location="global"/> </extra-includes> + <inject-code class="native" position="beginning" + file="../glue/qtgui.cpp" snippet="qimage-decref-image-data"/> <modify-function signature="load(const QString&, const char*)" allow-thread="yes"/> <modify-function signature="load(QIODevice*,const char*)" allow-thread="yes"/> @@ -1760,6 +1772,11 @@ </modify-argument> <inject-code class="target" position="end" file="../glue/qtgui.cpp" snippet="qclipboard-text"/> </modify-function> + <modify-function signature="mimeData(QClipboard::Mode)const"> + <modify-argument index="return"> + <define-ownership class="target" owner="default"/> + </modify-argument> + </modify-function> </object-type> <object-type name="QPaintEngineState"> <extra-includes> @@ -2625,9 +2642,7 @@ <enum-type name="FramebufferRestorePolicy" since="5.7"/> </object-type> <value-type name="QOpenGLFramebufferObjectFormat"/> - <!-- Compile error on Windows: QOpenGLPaintDevice::QOpenGLPaintDevice(const QOpenGLPaintDevice &)': attempting to reference a deleted function <object-type name="QOpenGLPaintDevice" since="5.0"/> - --> <object-type name="QOpenGLExtraFunctions" since="5.6"> <!-- Exlusions due to compile errors --> <modify-function signature="glEndTransformFeedback()" remove="all"/> diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp index 1c74c73d2..00d045787 100644 --- a/sources/pyside2/PySide2/glue/qtgui.cpp +++ b/sources/pyside2/PySide2/glue/qtgui.cpp @@ -190,6 +190,16 @@ for (int i = 0, i_max = %CPPSELF.count(); i < i_max; ++i){ %0 = new %TYPE(QPixmap::fromImage(%1)); // @snippet qpixmap +// @snippet qimage-decref-image-data +static void imageDecrefDataHandler(void *data) +{ + // Avoid "Python memory allocator called without holding the GIL" + auto state = PyGILState_Ensure(); + Py_DECREF(reinterpret_cast<PyObject *>(data)); + PyGILState_Release(state); +} +// @snippet qimage-decref-image-data + // @snippet qimage-constbits %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.byteCount()); // @snippet qimage-constbits diff --git a/sources/pyside2/PySide2/templates/gui_common.xml b/sources/pyside2/PySide2/templates/gui_common.xml index 16116877f..1a7406799 100644 --- a/sources/pyside2/PySide2/templates/gui_common.xml +++ b/sources/pyside2/PySide2/templates/gui_common.xml @@ -80,8 +80,9 @@ </template> <template name="qimage_buffer_constructor"> - auto *ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::copyData(%PYARG_1)); - %0 = new %TYPE(ptr, %ARGS, std::free); + Py_INCREF(%PYARG_1); + auto ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1)); + %0 = new %TYPE(ptr, %ARGS, imageDecrefDataHandler, %PYARG_1); </template> <template name="qcolor_repr"> diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py index ecc975ddf..876a0e401 100644 --- a/sources/pyside2/pyside_version.py +++ b/sources/pyside2/pyside_version.py @@ -39,7 +39,7 @@ major_version = "5" minor_version = "15" -patch_version = "4" +patch_version = "5" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). diff --git a/sources/pyside2/tests/QtCore/snake_prop_feature_test.py b/sources/pyside2/tests/QtCore/snake_prop_feature_test.py index 779b8a408..aea6a22ab 100644 --- a/sources/pyside2/tests/QtCore/snake_prop_feature_test.py +++ b/sources/pyside2/tests/QtCore/snake_prop_feature_test.py @@ -88,6 +88,8 @@ class FeatureTest(unittest.TestCase): window.modal from __feature__ import snake_case, true_property + #PYSIDE-1548: Make sure that another import does not clear the features. + import sys self.assertTrue(isinstance(QtWidgets.QWidget.modal, property)) self.assertTrue(isinstance(window.modal, bool)) diff --git a/sources/shiboken2/libshiboken/signature/signature.cpp b/sources/shiboken2/libshiboken/signature/signature.cpp index 601df4730..3051c50d5 100644 --- a/sources/shiboken2/libshiboken/signature/signature.cpp +++ b/sources/shiboken2/libshiboken/signature/signature.cpp @@ -454,7 +454,7 @@ static PyObject *adjustFuncName(const char *func_name) * Note that fget is impossible because there are no parameters. */ static const char mapping_name[] = "shibokensupport.signature.mapping"; - static PyObject *sys_modules = PySys_GetObject("modules"); + static PyObject *sys_modules = PySys_GetObject(const_cast<char *>("modules")); static PyObject *mapping = PyDict_GetItemString(sys_modules, mapping_name); static PyObject *ns = PyModule_GetDict(mapping); diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py index ecc975ddf..876a0e401 100644 --- a/sources/shiboken2/shiboken_version.py +++ b/sources/shiboken2/shiboken_version.py @@ -39,7 +39,7 @@ major_version = "5" minor_version = "15" -patch_version = "4" +patch_version = "5" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/feature.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/feature.py index ece3d2edb..e2edfe391 100644 --- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/feature.py +++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/feature.py @@ -132,13 +132,10 @@ def _import(name, *args, **kwargs): sys.modules["PySide2.QtCore"].__init_feature__() return sys.modules["__feature__"] - if name.split(".")[0] == "PySide2": - # This is a module that imports PySide2. - flag = existing if isinstance(existing, int) else 0 - else: - # This is some other module. Ignore it in switching. - flag = -1 - pyside_feature_dict[importing_module] = flag + if importing_module not in pyside_feature_dict: + # Ignore new modules if not from PySide. + default = 0 if name.split(".")[0] == "PySide2" else -1 + pyside_feature_dict[importing_module] = default return original_import(name, *args, **kwargs) _is_initialized = False |