aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatypedata.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Restrict types from unversioned imports only by major versionUlf Hermann2021-05-261-1/+1
| | | | | | | | | | | | | | | | | The versionless import tells us that any version of the type is allowed. We still record the major version because types have to be re-registered for each major version. Any minor version belonging to that major version is allowed, though. Restricting by minor version has the effect of passing the minor version of the "host" type into grouped property accesses. This is certainly unwelcome as the grouped type can have a higher minor version than the host type. Task-number: QTBUG-33179 Change-Id: I73f0f4fdaa00ac13cf91a4c21fd705c9dba070ec Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> (cherry picked from commit 5ca899164156ee49770ef3749e6d4b1567c00362) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QQmlMetaTypeData: Use a better container for the type modulesUlf Hermann2020-06-181-4/+33
| | | | | | | | | | | We often want to retrieve all type modules of a specific URI, no matter what version. Use a sorted vector to make those available without iterating all modules. Also, use a unique_ptr rather than manual memory management. Sorting the pointers should be fairly cheap, and we also don't have to store the keys anymore. Change-Id: I132c2ec3817afab1d60c3ba832d0b907ff6bfeb0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix race condition in QQmlData::createPropertyCacheFabian Kosmale2020-06-051-3/+3
| | | | | | | | | | | | | | As noted in QJSEnginePrivate::cache, there can be a race between calling addRef on the QQmlPropertyCache and another thread derefing and consequently deleting it. To avoid this, we introduce a doRef flag in QQmlMetaTypeData::propertyCache, which tells it to ref the the cache. This fixes the issue, as the QQmlMetaTypeDataPtr in propertyCache() acts as a mutex. Fixes: QTBUG-84692 Pick-to: 5.15 Change-Id: I962d28cfd22696aad89a660e41c55f63a8791b44 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Process major versions as part of Q_REVISIONUlf Hermann2020-02-131-8/+14
| | | | | | | | Retrieve the major version from the meta object revisions and use them to register types and generate qmltypes files. Change-Id: I35da8963457660d1a49ba9063574e1a68057a7ba Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-031-21/+24
| | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Register compiled-in QML typesUlf Hermann2019-11-071-2/+5
| | | | | | | | | If we compile the QML types into the main application we cannot depend on plugin loading for triggering the registration. Rather, we need to register them immediately. Change-Id: I910fb13359f8b7524eafd7693c85205cb4ed4cd8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add support for semi-automatic QML type registrationsUlf Hermann2019-10-141-0/+7
| | | | | | | | | | | | | | | We can use the new moc JSON output to collect all meta-objects at build time and, for those that include QML element registration meta-data, generate code that automatically registers these types with QML. This eliminates the need to call qmlRegisterType manually. For now this generates free-standing functions (per module) that need to be called manually. This is intended as an intermediate step. Task-number: QTBUG-68796 Change-Id: Ib414eef9757344feee488ebc7388f957b975347f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Small performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-1/+1
| | | | | | | | | mostly add const &, a few std::move and in particular case, remove const so the std::move being done over the variable actually has effect Change-Id: Id611cd31bc012f219d7a17d4626b1c2a5fbddd66 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Don't leak references to QQmlTypePrivateUlf Hermann2019-09-251-0/+1
| | | | | | Change-Id: I1cad0d8aa81b26a91e97a869f3c8539ae3cf1ad6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move propertyCache-by-minor-version into QQmlMetaTypeDataUlf Hermann2019-04-181-5/+26
| | | | | | | | | | | | Ths data structure should only be accessed when protected by the metatype data lock. In fact we don't access it from anywhere else. To make that more obvious, move it to the right place. This allows us to eliminate some const_cast and poking around in QQmlTypePrivate from the outside. Change-Id: I16ffd240b9504b9c00010bdb2d17b05c8196fe8a Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Use QQmlRefCount for QQmlType(Private)Ulf Hermann2019-03-191-1/+1
| | | | | | | | | | | | | As we already have an implementation of refcounting, we can just use that intead of inventing another one. This also gives us nice move ctors and operators. Also, use const pointers to QQmlTypePrivate where possible. This exposes quite some nastiness that needs to be fixed in follow-up commits: All the mutable members of QQmlTypePrivate are unsafe for multithreaded use. Change-Id: I3be8f2c53d86e06ffa80c8df8830473fe6d1d91d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-251-4/+4
| | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: I517c001ea4eb0fdd8e469f9fffe5b7559a5b0795
* Eliminate excessive friendlyness of QQmlTypeUlf Hermann2019-02-081-0/+6
| | | | | | | | | | | | QQmlMetaTypeData does need to be exposed to the QQmlType ctors. Rather, we can use factory functions to create the QQmlTypePrivate objects. The static attachedPropertyIds should really be part of QQmlMetaTypeData and access to them should be protected by the lock. Task-number: QTBUG-73271 Change-Id: I154a3842fab03a02c710901a20afd1652364808d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add public methods to query and set allowed revisions of property cachesUlf Hermann2019-02-071-2/+5
| | | | | | | We should not poke around in the private objects for this. Change-Id: If7089848d8310700a5a84efb0ff9b753a7de1f97 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QML: Split qqmlmetatype{_p.h|.cpp} into multiple filesUlf Hermann2019-02-061-0/+195
Having all those classes in one big file promotes spaghetti code and makes the code unreadable. Change-Id: I3b6df93b9cfe1d97228771049b3054e78b868ea3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>