Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libpyside: Reimplement signal connections for Python callables not targeting ↵Friedemann Kleint2024-08-211-180/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | a QMetaMethod The code previously used a instances of class GlobalReceiverV2 inheriting QObject in a hash in SignalManager per slot tracking the list of senders to be able to use standard signal/slot connections in Qt. This was a complicated data structure and had issues with cleanups. This has been replaced by using an invoker object based on QtPrivate::QSlotObjectBase which can be passed to QObjectPrivate::connect(const QObject *, int signal, QtPrivate::QSlotObjectBase *, ...). The connections (identified by ConnectionKey) are now stored in a hash with QMetaObject::Connection as value, which can be used to disconnect using QObject::disconnect(QMetaObject::Connection). Deletion tracking is done by using signal QObject::destroyed(QObject*) which requires adapting some tests checking on the connection count and weak ref notification on receivers as was the case before. [ChangeLog][PySide6] Signal connections for Python callables not targeting a QMetaMethod has be reimplemented to simplify code and prepare for removal of the GIL. Task-number: PYSIDE-2810 Task-number: PYSIDE-2221 Change-Id: Ib55e73d4d7bfe6d7a8b7adc3ce3734eac5789bea Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Split DynamicSlotDataV2 into separate classesFriedemann Kleint2024-07-111-143/+12
| | | | | | | | | | | | | | | | DynamicSlotDataV2 provided the callable for the slot invocation and contained switches depending on whether the callable was a method or a plain callable. Turn it into a virtual base class providing a call() method and a factory to cleanly separate the code paths for method and plain callables. Introduce an enumeration of slot types for clarity. Expose it in globalreceiverv2.h so that it can be used for PySideQSlotObject. Task-number: PYSIDE-2810 Change-Id: I4bdfb58a430c39aba2cc531c28129f71ebeb498c Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Refactor signature handling in GlobalReceiverV2Friedemann Kleint2024-07-091-22/+9
| | | | | | | | | | | | Move the signatures hash from DynamicSlotDataV2 into GlobalReceiverV2 to avoid unnecessary indirections and to enable further refactorings of DynamicSlotDataV2. Use QByteArray for the signature parameters, avoiding the conversion. Task-number: PYSIDE-2810 Change-Id: I17a637e28e9dac4ea159b26a375e8c1535e00814 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Add explanatory comment about methodsFriedemann Kleint2024-06-241-2/+6
| | | | | | Pick-to: 6.7 Change-Id: I0731c9c02de928dcdf268f5fc773148363b9a8fe Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Fix static analysis warningsFriedemann Kleint2024-06-241-6/+4
| | | | | | | | | | | | | | | | - Initialize variables - Use auto * - Remove repeated return types - Fix else after return - Fix some invocations of static methods - Make functions const/static where appropriate - Fix some int types to avoid lossy conversions - Use Py_RETURN_NONE where appropriate - Minor cleanups - Remove some macros Change-Id: I7fa7a29e7b3dc47037027978001824e0709d001f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Remove short circuit signal handlingFriedemann Kleint2024-05-271-2/+1
| | | | | | | | | | | There was a "Short circuit" code path triggering on QMetaMethod signal signatures without parentheses, which is apparently dead. Task-number: PYSIDE-2667 Change-Id: I68c4c636ea224a7691e76286ed43f5aaaa6d4bd7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* libpyside: Fix spelling error in function nameFriedemann Kleint2024-03-251-1/+1
| | | | | | | | | | Amends 1270a9e82e5bc3bd53a1131698ece60403da1192. Task-number: PYSIDE-2646 Task-number: PYSIDE-2141 Pick-to: 6.7 6.6 6.5 Change-Id: Ib8a5146766166ec4fa7ae7b42ce6d52ccae0b3c6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use PyType_GetSlot() instead of accessing PyTypeObject's slots in library codeFriedemann Kleint2024-01-161-1/+2
| | | | | | | | | | Using PepType_GetSlot() as is requires adding ugly casts. To work around, add a new file with convenience helper functions in C++ linkage. This also allows for using templates for tp_alloc. Task-number: PYSIDE-560 Change-Id: Ia50a226f5b545861f885d600445b91b4e11713c5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Modernize qHash functions preparing introduction of Qt's comparison helpersFriedemann Kleint2023-12-191-9/+0
| | | | | | | | | Use qHashMulti, noexcept and make them inline friends. As a drive-by, also make comparison for Clang structures noexcept. Pick-to: 6.6 Change-Id: Ibdcbf3bde90af0fc419bd1640d3f45602f772f9a Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libshiboken/libpyside: Fix some static analysis warningsFriedemann Kleint2023-09-201-1/+1
| | | | | | | | | | | | - nullptr - narrowing integer conversions - else after return - Use auto - Missing move special functions Pick-to: 6.6 6.5 Change-Id: Ib872481a46c8bb17592cdc1778ab3c4d9598c753 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PySide6: Add debug operators for DynamicSlotDataV2/GlobalReceiverV2Friedemann Kleint2023-06-271-0/+54
| | | | | | | | Task-number: PYSIDE-2371 Task-number: PYSIDE-2299 Pick-to: 6.5 Change-Id: I1d3edf539e156a3a64f9e4b4499bc967b0da2ade Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Revert anonymous slot memory leak fixAdrian Herrmann2023-06-021-10/+1
| | | | | | | | | | | | | | | The fix to PYSIDE-2299 unfortunately introduces regressions that are more serious than the memory leak caused by an edge case that was originally supposed to be fixed. A different approach will be needed to fix the memory leak, in the meantime, revert the change. The corresponding unit test remains blacklisted, as it will apply to a future fix. Pick-to: 6.5 Fixes: PYSIDE-2346 Task-number: PYSIDE-2299 Change-Id: I1dcddb03f731a333f6acf7c9df79b9dba42bec21 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Leak fix: special consideration for functools.partialShyamnath Premnadh2023-05-251-0/+5
| | | | | | | | | | | - Amends 5b39b316e3c9e40cdc0784538b8d5f290e41d67b until proper fix is deviced. Task-number: PYSIDE-2299 Change-Id: Ia4ace136cb44d092691fdfd030de1889f1d3c671 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit cc2054bc13ac91da50e3e796e107f12883176314) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix leak connecting signals to anonymous functionsAdrian Herrmann2023-05-111-1/+5
| | | | | | | | | | | | | | | | | When connecting a signal to the same anonymous function repeatedly, a new GlobalReceiverV2 object would be created after each call. Each GlobalReceiverV2 would have a unique callback object despite all these callback objects sharing the same code. This would lead to a large number of GlobalReceiverV2 and callback objects, each never reaching a refcount of 0 and thus never being released. The remedy is that we only need one GlobalReceiverV2 object, whose corresponding GlobalReceiverKey references not the outer callback object, but the code object associated with it. Pick-to: 6.5 Fixes: PYSIDE-2299 Change-Id: I474284dc5ce08dc6601636f2e7ac5e5a10ed8560 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Rename the static stringsFriedemann Kleint2022-12-161-4/+4
| | | | | | | | | | | | Shiboken::Py(Magic)Name needs to be disambiguated from PySide::Py(Magic)Name as otherwise using namespace Shiboken; using namespace PySide; leads to ambiguities in jumbo builds. Task-number: PYSIDE-2155 Change-Id: I7ffd1c9325f9c9a83be8ef797aebb096cc15f593 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix QObject::sender() for non-C++ slotsFriedemann Kleint2022-12-121-2/+12
| | | | | | | | | | | | | | | For non-C++ slots routed via GlobalReceiverV2, sender() of the receiving QObject returns 0. To fix this, store the sender obtained in GlobalReceiverV2::qt_metacall() temporarily in a special dynamic property of the receiver and inject code checking it into QObject::sender(). This fixes at least the synchronous calls. Fixes: PYSIDE-2144 Fixes: PYSIDE-1295 Change-Id: Ia111162eb1404914ecfb7f19fadb8a1b63ae8b4a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix a crash when deleting QObject instances with connections in threadsFriedemann Kleint2022-12-081-89/+24
| | | | | | | | | | | | | | | | | | | GlobalReceiverV2 connected to the destroyed() signal of the senders to keep track of its lifetime, which caused issues with delayed emission of signals when using threads. To fix this, change GlobalReceiverV2's sender list to use QPointer, which automatically tracks the lifetime of the pointees. Move the deletion of the GlobalReceiverV2 instances into SignalManager, completely, removing the "delete this" pattern used. This allows for removing some hacks for the QObject::receivers() function. Fixes: PYSIDE-2141 Change-Id: I361256f919dab13bfcf20800624b2454308bbc4b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove remaining Q_NULLPTRFriedemann Kleint2022-12-071-1/+1
| | | | | | | | Pick-to: 6.4 6.2 Change-Id: I80511f42164de4494371c9016ee745e3da0493ee Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Move helper isCompiledMethod() to pysideutils.hFriedemann Kleint2022-01-191-0/+1
| | | | | | | | | | | It appears to be a general use helper function which could be useful outside signalmanager as well. Amends 56f66f128566bd08f027fee46bb42a6c4f57a26e. Task-number: PYSIDE-1755 Change-Id: I449243bb5d800ba4d271b3079ad394810d468312 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Safe distinction of Nuitka compiled methodsShyamnath Premnadh2022-01-181-4/+2
| | | | | | | | | | | | | | | | | | Adds an extra check to see if __code__ is present. As mentioned in PYSIDE-1755, Mocks are callable objects without __code__ attribute, unlike Python Method or Functions. However, a Mock also has im_func__ and im__self attributes. We made the assumption __code__ would be present if im_func and im_self are present, and this makes it fall under the category of a compiled method. This patch makes an extra check to see if __code__ is present. If it is not, then the Slot (here Mock) is considered as a callable method. Task-number: PYSIDE-1755 Pick-to: 6.2 Change-Id: If7e8f52dfb2409cd856eec0d0b41891d751d8a69 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Remove unused dynamicqmetaobject_p.hFriedemann Kleint2022-01-071-1/+0
| | | | | Change-Id: I4aef7765fc2647cd597fb316535fe28dc43cef01 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Fix crash when connecting slot after disconnecting non-existent ↵Friedemann Kleint2021-11-191-2/+4
| | | | | | | | | | | connection to same slot Add a null-check. Fixes: PYSIDE-1715 Pick-to: 6.2 5.15 Change-Id: I0fc8c1b051b04eacd6bd75542ceaf9f23a825cab Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside6: Use isEmpty() instead of empty() for Qt containersFriedemann Kleint2021-11-191-3/+3
| | | | | | Pick-to: 6.2 Change-Id: I0e2f7164bd89ae75eb2aa1cb82adcfa317aea309 Reviewed-by: Christian Tismer <tismer@stackless.com>
* nuitka: Fix slot access for compiled functionsChristian Tismer2021-06-061-0/+6
| | | | | | | | | | | | | | The function DynamicSlotDataV2::key needs to handle compiled functions as well, which are not covered by a PyMethod_Check. The author of this patch is Kay Hayen. Some AutoDecref usage was then applied for simplification. Change-Id: I8d0f0c15100a385fd655a96c95a25bacb1b61f1b Fixes: PYSIDE-1589 Pick-to: 6.1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Nuitka: Allow for compiled functions and methods tooChristian Tismer2021-03-261-7/+21
| | | | | | | | | | | | | | | | | | | | | | The author of this patch is Kay Hayen. He writes: * Add support for compiled methods to the bindings manager. * For slots, implement lookup of code objects for compiled methods and functions with a new function avoiding code duplication. * Look up attributes of slots, e.g. code objects that Nuitka also has as well, methods have "im_func" and "im_self". * Sometimes calling "tp_descr_get" Python object slot is the universal thing to do, covering all types. * Detect compiled methods as receiver targets too. Task-number: PYSIDE-1523 Change-Id: I0277b583840710476198ed5e1ccaaccd672e7638 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix some clang analzyer warningsFriedemann Kleint2021-03-111-7/+9
| | | | | | | | | | | | - Use nullptr - Initialize variables - Remove else after return - Remove C-style casts - Avoid constructing QString from const char * - Use emit for signals Change-Id: I6ba8cad51f4b2a22f94996d1a9d8c3ae87c35099 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Refactor GlobalReceiverV2MapFriedemann Kleint2020-11-171-30/+27
| | | | | | | | | | | | | | | | Use a QHash of object/method PyObject instead of a QByteArray representing the sum of hash values of both as a string. The problem with using hash functions here is that 2 keys might be identical due to the hashing. Rename the hash() methods to key(). Task-number: PYSIDE-1422 Change-Id: Ie1344d8bd85a073ef5f6e2cb461bd2f514265a9f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* globalreceiverv2: Avoid hash call on instances which might be unhashableChristian Tismer2020-11-171-7/+8
| | | | | | | Change-Id: I423763b363cff61beb5da45374f120e5f2e63ffa Fixes: PYSIDE-1422 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-021-0/+348
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>