aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compat/removed_api.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtQml: Avoid potential gc issuesFabian Kosmale2024-12-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicitly constructing a value from a ReturnedValue muddies the responsibility for ensuring that the gc can find the object. With this change, we disable the implicit conversion. The expectation for lifetime management is now: - If a ReturnedValue is stored on the C++ stack, it must be put into a QV4::Scoped class (or there should be a comment why not doing so is safe). Passing a ReturnedValue to a function should no longer be possible, unless the function takes a ReturnedValue, in which case the expectation is that it stores the value in a place where it can be seen by the gc, before doing anything that could trigger a gc run. Using Value::fromReturnedValue can still be used to pass a Value on, but in that case, the expectation is that there is a comment which explains why this is safe. - If a QV4::Value is obtained from a function call, it ought to be stored in a ScopedValue, too. We currently can't enforce this easily, so this should be checked during code review. A possible way forward would be to disallow returning Values, but that would be a larger change, and is deferred to the future. - If a functions has a QV4::Value parameter, it's the callers' responsibilty to ensure that the gc can find it. Pick-to: 6.9 6.8 6.5 Fixes: QTBUG-131961 Change-Id: Iea055589d35a5f1ac36fe376d4389eb81de87961 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QtQml: Simplify AOT lookup initialization APIUlf Hermann2024-11-141-0/+36
| | | | | | | | | | | We don't need the type arguments anymore. Change the functions to not accept them and the code generator to not generate them. This involves remembering the "isShadowable" flag until we potentially have to re-initialize a lookup for a write back operation. Change-Id: I036f87de20061ae9f2c7588a41bcdca0cd72df02 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* QtQml: Remove CallGlobalLookup adapters for AOT-compiled codeUlf Hermann2024-11-121-0/+24
| | | | | | | | | It's currently impossible to generate code that uses them. Furthermore the API is quite wrong in that it needlessly takes all types as part of the call rather than the initialization. Change-Id: Ic452cb68f43410d9ebafd29d55a4d02273d95b9b Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
* QmlCompiler: Support construction of value types with 'new'Ulf Hermann2024-11-061-0/+9
| | | | | | | | | | | | | This allows us to create value types with invokable copy ctors from JavaScript objects that describe their properties. That way we now have a full replacement for the Qt.foo() methods. As a side effect, we support retrieval of enums for certain kinds of broken value types now, if prefixed with a namespace. Fixes: QTBUG-124634 Change-Id: If2a3c59d647e211ef5a0cd1ddee04b409d9ea5f3 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* QmlCompiler: Make loadGlobalLookup work like other lookupsUlf Hermann2024-10-251-0/+18
| | | | | | | | Cache the metatype in the lookup rather than re-calculating it in every call. Change-Id: I5fde45a05a3d515466d9cf360bf51d7a8c9cb816 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Call lookups based on enums rather than via function pointersUlf Hermann2024-10-241-2/+2
| | | | | | | | | | | | | | | | | While the C++ standard says that different functions need to have unique addresses, some compilers have take substantial liberties with that rule. This means we can't actually rely on the addresses of our different lookup functions to differ and therefore we cannot use them as discriminator. Introduce an enumeration for all the different lookups and use that instead. Now we can also drop all the purely redirecting methods we've introduced just to have different addresses. Change-Id: Ifa68c27c0d2fef4084893a19227dab21bd948dfd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QtQml: Rename all "Lookup *l" to "Lookup *lookup"Ulf Hermann2024-10-201-8/+8
| | | | | | | | | | Codechecker complains about ambiguous 1-letter names, and especially 'l' vs 'I'. Change-Id: Ia32c2a8eb04956bb10e7e49e2085b724e8feb749 Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QmlCompiler: Resolve types for calls in init stepUlf Hermann2024-10-141-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that resolving the types can be more expensive, especially for composite types, we should be careful not to do it too often. Most of the cases where we have to resolve types are for lookups. Most of the lookups only resolve types in their "init" step, which ideally is only performed once in the application life time. However, so far calls had to pass the types of arguments and return values in the actual "lookup" step, which causes the resolution to happen on every call. This change moves those type resolutions to the init step. We can do this because: 1. Regular typed method calls are calls to a specific overload with specific types. The method itself already has the list of types and we can just remember which one that is. Then we don't need to pass the types. 2. Calls to shadowable methods are all-QVariant typed. The only thing we need to know is the number of arguments. Then we can construct the list of types in the lookup itself. We can remember which one of those we're dealing with by adding further "AsVariant" lookup functions. For the case of non-property-cached regular methods we also need a new "Fallback" lookup like we already have it for properties. Change-Id: I74a3729131d6a5ea0ad79e276965a5167cd609be Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
* qqmlprivate.h: Fix BC issueFabian Kosmale2023-11-011-0/+16
| | | | | | | | | | | The old function might still be callde from code compiled against Qt < 6.6. Fix this by providing the old overload in removde_api: It is implemented by calling the new overload, and then converting the result to an int. Amends f10630aa035ae1ef4ad75be1107ab77fea0c7e29. Pick-to: 6.6 Change-Id: I373460af2a66c069bfc0b57a9bb169d705d2a6b9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QJSEngine: Move old convertV2 to removed_api.cppUlf Hermann2023-01-311-0/+5
| | | | | | Pick-to: 6.5 Change-Id: I7f700d64694c8651769841a0109d32e8f9a839b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix minor API problemsUlf Hermann2023-01-181-0/+21
Add explicit where appropriate, and use more elegant constructs in inline functions. Introduce removed_api.cpp for QJSEngine::create(int, const void *). Pick-to: 6.5 Change-Id: Ie54b0494fe3c5567f8a5ca361c3a583de3d97dd5 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>