aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/signalmanager.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libpyside/libpysideqml: Introduce base class for the propertiesFriedemann Kleint48 hours1-1/+1
| | | | | | | | | | | | | | | | | | | | | | Previously, PySidePropertyPrivate was used as a base class for QmlListPropertyPrivate. Whereas PySidePropertyPrivate kept track of the fget()/fset() and other helper functions and provided tp_traverse and tp_clear, QmlListPropertyPrivate only kept flat pointers to its helper functions (at(), append(), ...). This can cause issues if for example a lambda is passed as callable. QmlListPropertyPrivate also does not use any of the fget()/fset() members. To address this, extract a new base class PySidePropertyBase class which has only the relevant members for both, and move PySidePropertyPrivate into the source file. Add Py_TPFLAGS_HAVE_GC to QmlListPropertyPrivate and track its members similar to PySidePropertyPrivate. Task-number: PYSIDE-3227 Change-Id: I7a739aa7b6f2c2811bde5b99a397ac752b20b69c Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Add globals structureFriedemann Kleint2025-10-021-2/+3
| | | | | | | | | Put global data into a struct which in the future will exist per interpreter as interpreters can only share immortal objects. Task-number: PYSIDE-3155 Change-Id: I45ccaac57b41219bd4bd6a9151f820b00a787b0e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix clazy warnings about too-large underlying types of enumerationsFriedemann Kleint2025-10-021-1/+1
| | | | | | | Use the types suggested by clang-tidy. Change-Id: I2f96d52831fd53140a1bb727e604194afd76f920 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside/signalmanager: Change metaObjectAttr to be an immortal stringFriedemann Kleint2025-09-301-7/+8
| | | | | | | Pick-to: 6.10 Task-number: PYSIDE-3155 Change-Id: I808bd38b57650bb5a4f6933fbc00aa3086279693 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PySide6: Output meta call name instead of enum number in error messageFriedemann Kleint2025-09-151-1/+13
| | | | | | | | | | The error can be triggered when not fully implementing a property for QML, and the number is then not very helpful since it is an internal enum. Pick-to: 6.10 6.9 6.8 Change-Id: I15a2f7f097b24fc3ed6f2b763d58e871d5bed724 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken: Split out PEP functions from sbkpython.hFriedemann Kleint2025-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libshiboken provides replacement functions prefixed "Pep" for functions missing from the limited API or appearing in future Python versions (pep384impl.h, bufferprocs_py37.h, pep384ext.h). This used to be included in the sbkpython.h header, which provides a sanitized Python.h. This patch removes the PEP headers from sbkpython.h header, requiring code using the replacement functions to explicitly include new headers (sbkpep.h, sbkpepbuffer.h). The generator automatically includes sbkpep.h for code snippet compatibility. The aim is to be able to identify code using the replacement functions. It is expected that the usage decreases over time as the Limited API versions are raised and more eplacement functions become obsolete. [ChangeLog][shiboken6] libshiboken's replacement functions providing functions missing from the limited API or appearing in future Python versions have been moved from sbkpython.h (providing a sanitized Python.h) to separate headers sbkpep.h and sbkpepbuffer.h (providing buffer API). This should not affect binding code as the generator includes the new headers, but may require adaption in client code using libshiboken/libpyside directly. Task-number: PYSIDE-3171 Change-Id: I5d79a40ba6755a80c8da99e4ddd6ef93463b4ddf Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Reduce usage of PyTypeObject::tp_nameFriedemann Kleint2025-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | In the Limited API, PyTypeObject is an opaque struct, for which libshiboken provides a dummy definition. PyType_GetFullyQualifiedName() (stable API since 3.13) can be used as a replacement, but it returns a PyObject. Add a convenience function PepType_GetFullyQualifiedNameStr() similar to the existing PepType_GetNameStr() to return a C-string. Leave the 3.13 code commented out for the moment since it causes a crash. This does not cover occurrences of tp_name passed as strings to Python formatting functions using the %s placeholder since that can be replaced by the new %N/%T placeholder starting from 3.13. Task-number: PYSIDE-3171 Change-Id: I4a073872cd0d138b8d8c6aafb08ccb33451812ca Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Disable GIL: Basic adaption and compile fixesFriedemann Kleint2025-07-091-0/+6
| | | | | | Task-number: PYSIDE-2221 Change-Id: Ib494a0404de4aa463078b5fd9788e40cecc25ae8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix crash retrieving a PyObject type property via QVariant<PyObjectWrapper>Friedemann Kleint2025-05-191-16/+18
| | | | | | | | | | | | | | | | | | | | | The old code registered a Shiboken converter for PyObjectWrapper by pointer conversion. This resulted in the Python to C++ converter falling back to plain pointer passthrough since it only works for SbkObjects. The C++ to Python conversion worked by coincidence for either raw PyObject * pointers used in meta call handling or pointers obtained from calling QVariant<PyObjectWrapper>.data(), but without handling reference counts. To fix this, remove the Python to C++ conversion entirely and do this manually via QVariant. Change the C++ to Python to be by value and use PyObjectWrapper. Fixes: PYSIDE-2193 Pick-to: 6.9 Change-Id: I00898894651f220d7b8fe60608e93233ef3e6493 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Add a debug operator for PyObjectWrapperFriedemann Kleint2025-05-161-1/+24
| | | | | | | | | This useful for debugging QML issues. Task-number: PYSIDE-2193 Pick-to: 6.9 Change-Id: Iecbfb1d9508ac89c8b213a2f2ee8d4f7f1de4fc8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Make PyObjectWrapper movableFriedemann Kleint2025-05-131-0/+12
| | | | | | | | | This is required by today's QVariant conversion code. Task-number: PYSIDE-2193 Pick-to: 6.9 Change-Id: I66efcfb797653fe1d617f1f0027fd60ec95e8a79 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libshiboken: Add utility class for stashing Python errorsFriedemann Kleint2025-05-071-8/+3
| | | | | | | | | It encapsulates fetching/restoring errors and uses the old or new exception API depending on version. Task-number: PYSIDE-3067 Change-Id: I6e39d92c7e79fed864b364a90c5bd5b474a41ed6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Port to Qt include styleFriedemann Kleint2025-03-271-6/+6
| | | | | | | | | Replace the Qt forwarding headers by the .h files. This brings down the dependency list by approx 6%. Pick-to: 6.9 Change-Id: Iae7640ccbdf6a8be68137922d4191522d914d790 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix crash of signals with object-type parameter being passed by const-refFriedemann Kleint2025-02-111-3/+8
| | | | | | | | | Add a further indirection in callPythonMetaMethodHelper() when only a pointer conversion is available for a const-ref parameter. Task-number: PYSIDE-3004 Change-Id: I6ec7c5a9d4d30c8e4973ec79534d5f3eb3bf8204 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Fix some clang-tidy warningsFriedemann Kleint2025-02-031-1/+1
| | | | | | | | - Remove superfluous casts Pick-to: 6.8 Change-Id: I8dd7cdd1e9d3f30103fc6d87bf04d7f0d0182603 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* limited api: Remove PyBytes_AS_STRING and PyBytes_GET_SIZECristián Maureira-Fredes2024-11-081-2/+2
| | | | | | | | | Remove old macros usages for the Limited API compatibility, and doing some refactorings to their usages. Change-Id: I10d675a1831d26b3fc878151e3a6ec40c5caddb1 Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* limited api: Remove PyTuple_GET_ITEM, PyTuple_SET_ITEM, and PyTuple_GET_SIZE ↵Cristián Maureira-Fredes2024-11-081-1/+1
| | | | | | | | | | | macros Removing old macros for compatibility with the limited api, and refactoring some of their usages Change-Id: I33954199d2ef9884c64b963863b97aed851c440f Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix error handling in non-slot connection receiversFriedemann Kleint2024-10-211-0/+4
| | | | | | | | | | | | | | | Extract the error handling code which existed duplicated in GlobalReceiverV2::qt_metacall() and SignalManagerPrivate::handleMetaCallError() as a static helper of SignalManager and call that from the DynamicSlot functions. Amends 33bd61d13d8d9e3794b6049891be62f3351313d9. Pick-to: 6.8 6.8.0 Task-number: PYSIDE-2810 Fixes: PYSIDE-2900 Change-Id: Ife9f156e6752dde7002218d36d369ba68ad595b0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Reimplement signal connections for Python callables not targeting ↵Friedemann Kleint2024-08-211-207/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Refactor signature handling in GlobalReceiverV2Friedemann Kleint2024-07-091-1/+1
| | | | | | | | | | | | 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: Pass MetaObjectBuilder signature as QByteArrayFriedemann Kleint2024-07-091-35/+59
| | | | | | | | | | | | | | Change the MetaObjectBuilder::addSlot()/addSignal() functions to use a QByteArray since the underlying QMetaObjectBuilder takes QByteArray, too. Split SignalManager::registerMetaMethodGetIndex() into overloads for const char * (for the signal code path) and QByteArray (for the slot code path). Task-number: PYSIDE-2810 Change-Id: Ie79ea071a8cc111d45248c7086cf6fda34a7548f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside: Decouple SignalManager::callPythonMetaMethod() from QMetaMethodFriedemann Kleint2024-07-041-46/+118
| | | | | | | | Extract a helper for calling Python slots and add an overload that only takes a list of parameter types and return type. Change-Id: I407c3b1ae66eb4f01370ceac3112eb9407796efa Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix static analysis warningsFriedemann Kleint2024-06-241-9/+11
| | | | | | | | | | | | | | | | - 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-24/+5
| | | | | | | | | | | 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>
* Multimedia: Adapt to revert of QAudio->QtAudio namespace renamingFriedemann Kleint2024-04-121-5/+0
| | | | | | | | | | | | Partially revert 4d761eaaf852f8d82925e111150f25c0dd5f3e83. Adapt to qtmultimedia/7fcea568c9c64f3bcebda21f0df02aa0107dfd0c, reverting qtmultimedia/edaec2bf714c98d65f12c8ed9a2ffbd1603635a7. Task-number: QTBUG-123997 Pick-to: 6.7 Change-Id: Ibd0ad737293f4b9107909f37554c03f64bce5d1e Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* libpyside/Signal manager: Ensure cleanup of main thread targetsFriedemann Kleint2024-04-021-4/+65
| | | | | | | | | | | | | | | | Restore a notification on a sender's QObject::destroy() signal for main thread objects. Instead of triggering instant deletion as was done before (causing issues with recursion and threads), start an idle timer to call the Signal manager cleanup. Amends 1270a9e82e5bc3bd53a1131698ece60403da1192. Pick-to: 6.7 Task-number: PYSIDE-2646 Task-number: PYSIDE-2141 Change-Id: Ifdc28f729cab64d58ac2ab300daece98b167d915 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Clean up lambdas connected to signals earlier in shutdownFriedemann Kleint2024-03-251-1/+20
| | | | | | | | | | | Run a signal handler cleanup in CoreApplication::aboutToQuit() already before the general cleanup. This prevents them from leaking out of a main() function, for example. Task-number: PYSIDE-2646 Pick-to: 6.7 6.6 6.5 Change-Id: I87cce8d131c40c02b44b0102b3774477676b8f89 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Fix spelling error in function nameFriedemann Kleint2024-03-251-8/+8
| | | | | | | | | | 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>
* libpyside: Improve type conversion error messages of metafunction invocationFriedemann Kleint2024-03-131-21/+36
| | | | | | | | | Refactor and streamline the code a bit. Pick-to: 6.6 Task-number: PYSIDE-2633 Change-Id: I433b136ac036a9a297d2c22ad8dfa6af45ad46b0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Adapt to renaming of namespace QAudio->QtAudioFriedemann Kleint2024-02-281-1/+9
| | | | | | | | | | | - Adapt the examples. - Create an alias into the module. - Add a hack to the signal manager for signals which maintain the old string-based signature. Task-number: PYSIDE-2497 Change-Id: I9db5e59851a2cb9161fdcecf87e78d980eda2045 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve error messages around signal/slot connectionsFriedemann Kleint2023-10-171-3/+5
| | | | | | | Task-number: PYSIDE-2487 Pick-to: 6.6 6.5 Change-Id: I93d2c350aecf1339c6b18496f376d04cdd37dc29 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken/libpyside: Fix special functionsFriedemann Kleint2023-10-061-0/+3
| | | | | | | | Pick-to: 6.6 Task-number: PYSIDE-2479 Change-Id: I6df19d487be7087f17e37bea3ea30a66e9b24ed7 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix namespacesFriedemann Kleint2023-09-201-19/+11
| | | | | | | | | | | - Use nested namespaces instead repetitive namespace declaration - Remove anonymous namespaces that contain only static functions. "static" is sufficient here, the anonymous namespace only increases compilation time. Pick-to: 6.6 6.5 Change-Id: I6cd1b63da79eaf40a1b7ae031def97fa22903e99 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Adapt to Qt 6.6Friedemann Kleint2023-07-071-0/+4
| | | | | | Change-Id: Ie6379044282809fe73790d03cd086845bee98089 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PyEnum: Shortcut old Enum code and generate Python enums directlyChristian Tismer2023-06-301-1/+0
| | | | | | | | | | | | | | | | | The amalgamation of old and new enums is slowly unraveling from the inside. This meanwhile actually removes the old code. Included a change by Friedemann to improve enum value handling. After the signed/unsigned problem was fixed, there was only one case left where Qt and Clang parser disagreed which could be fixed. The final solution uses overloaded functions to generate all necessary cases with minimal footprint in the executable. Task-number: PYSIDE-1735 Change-Id: I3741ce8621e783a750f3c05241c916008f78f39b Done-with: Friedemann.Kleint@qt.io (+2 squashed commits) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6/SignalManager: Fix memory leaks connecting free methods/lambdasFriedemann Kleint2023-06-281-0/+19
| | | | | | | | | | | | | | | | | Change 1270a9e82e5bc3bd53a1131698ece60403da1192 changed the deletion of global receivers from listening to QObject::destroyed() (which caused thread issues) to using QPointer<> and purging the lists in notify. What is missing was the deletion of global receivers that are not tied by weak reference to a Python instance. Add a check in notify() to clean out the empty global receivers. Pick-to: 6.5 Fixes: PYSIDE-2371 Fixes: PYSIDE-2299 Task-number: PYSIDE-2141 Change-Id: I39dca2a21088930c9a7f8e5eb7e948b3fff49b4b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Enum: Enable toInt for QVariant(PyEnum/SbkEnum)Shyamnath Premnadh2023-06-131-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | - For Python/Shiboken types not known to Qt that requires wrapping around a QVariant, we use the PyObjectWrapper type. This patch registers a toInt() QMetaType converter for PyObjectWrapper, which enables automatic conversion to int for a QVariant(PyObjectWrapper) within C++ i.e. QVariant(PyObjectWrapper).toInt() will work - This means that cases like QAbstractItemModel::data() that calls QtPrivate::legacyEnumValueFromModelData(const QVariant &data) would work without explicit conversion from QVariant(PyObjectWrapper) to QVariant(int). But for cases like QMetaProperty::write() explcit handling is still required. - This would also work for cases where the QVariant(PyObjectWrapper) is simply channeled from Python to C++, and from C++ back to Python without performing any operations on it. - Incase, the wrapped object is not a PyEnum/ShibokenEnum object, then toInt() would return a -1. Pick-to: 6.5 Task-number: PYSIDE-1930 Task-number: PYSIDE-2339 Change-Id: I983351f2ff88c79c29399c257e38421116efc7a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Implement raising of unraisable exceptions correctlyChristian Tismer2023-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | TODO in another check-in: Control exec/run by an XML attribute [ChangeLog][PySide6] Unraisable exceptions are now handled by a handler on the stack or printed if impossible. Unraisable exceptions are stored in an error store if there is an error handler on the call stack that can handle it, otherwise it is printed immediately. We record the existence of an error handler in thread local storage, which solves thread problems automatically. Since exec and run functions completely block all handlers, we need to mark them as a special case. The overhead is minimal and uses constant memory per thread. Task-number: PYSIDE-2310 Task-number: PYSIDE-2321 Change-Id: Ic25a2ff8552baf6e132ad86a4ad0925375e7ea88 Fixes: PYSIDE-2335 Pick-to: 6.5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Shiboken: Undo the unraisable exception delay for nowChristian Tismer2023-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | The delayed exception looked good in the first place. PYSIDE-2310 and PSIDE-2321 showed some special cases where the delayed error reporting fails to notify about an error, to be in time (2321) or all-together (2310). This is no complete reversal of the thing. We need to improve the theory to cover all cases and do a better implementation. This temporary reversal removes the pressure from us to get the feature perfect before the 6.5.1 release. Change-Id: Idf25ca31571a45c59082d27e4d736a4932ab9f8c Fixes: PYSIDE-2310 Fixes: PYSIDE-2321 Pick-to: 6.5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* property/QML: Improve handling of an unknown class nameChristian Tismer2023-01-061-3/+19
| | | | | | | | | | | | | | | | | pysideproperty has Q_ASSERT calls, which cause errors when a typename is undefined. This behavior is inconsistent and should either raise an exception or be circumvented. For compatibility with another implementation, unknown types are now ignored, and debug and release are consistent. To obtain an error, run the script with -Werrors . This makes use of the new exception delay feature. Task-number: PYSIDE-2160 Change-Id: Ia320edab4b51dd6f6b94a429b8f1f086ce9897f7 Pick-to: 6.4 6.2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide6: Port from QSharedPointer to std::shared_ptrFriedemann Kleint2023-01-041-4/+4
| | | | | | Task-number: QTBUG-109570 Change-Id: Ieb13bf352d9b75e364a73bddc464548ec19701ed Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix QObject::sender() for non-C++ slotsFriedemann Kleint2022-12-121-2/+3
| | | | | | | | | | | | | | | 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>
* libpyside: Potential fix for crashing signals/disconnect_test.pyFriedemann Kleint2022-12-121-1/+14
| | | | | | | | | | Bring back the deletion loop removed by 1270a9e82e5bc3bd53a1131698ece60403da1192. Task-number: PYSIDE-2141 Change-Id: If11196d8d035eddffc1ffc22b7e1da6be8260515 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-47/+36
| | | | | | | | | | | | | | | | | | | 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>
* Fix clazy warningsFriedemann Kleint2022-11-111-4/+4
| | | | | | | | | - Fix missing reference in for loop - Fix potential memory leak on error in SignalManager Pick-to: 6.4 Change-Id: I14819572ae250469eccac90dfbc905bf0d33c9de Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix warnings about unused parameters in codeFriedemann Kleint2022-09-261-1/+1
| | | | | | Pick-to: 6.3 6.2 Change-Id: Ie120284b290d22f2786591955465e0334555e658 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add a logging category to libpysideFriedemann Kleint2022-08-261-0/+88
| | | | | | | | | | | | | | | | | | It provides: - Debug output for Qt meta calls (useful for debugging QML applications). - Warnings, for example about dynamic slot registration caused by missing decorators. It can be enabled for example by export QT_LOGGING_RULES="qt.pyside.libpyside.warning=true". [ChangeLog][PySide6] A logging category "qt.pyside.libpyside" with warnings has been added to libpyside. Task-number: PYSIDE-2033 Change-Id: Ie972b85b8e92d2f3e2cf00efbc1047a178d95241 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Output a warning when a property metacall failsFriedemann Kleint2022-08-161-1/+5
| | | | | | Pick-to: 6.3 6.2 Change-Id: Ib435b4b87a92e859a5e1da0b54e6d442b465defc Reviewed-by: Christian Tismer <tismer@stackless.com>
* Adapt to Qt 6.4Friedemann Kleint2022-06-291-0/+1
| | | | | | Change-Id: I46f6291c1c363b1e509ef458e635f97f4423f81b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use SPDX license identifiersLucie Gérard2022-05-271-39/+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>