aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue with bindings to aliases that cannot yet be resolvedErik Verbruggen2018-03-151-54/+85
| | | | | | | | | | | | | | | When an alias points to a child object which has not yet been initialized, it's id won't have been registered yet, so setting up a binding to it will result in a crash. The fix is: when setting a binding target fails, and its target property is an alias, queue them until all bindings have been set up, and try again. Task-number: QTBUG-57041 Change-Id: I4dc5a6d25c0a32fed9fd952c955e2006c76be45a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> (cherry picked from commit aa94c6c0469b0595f483f13ac88459f0035deef9)
* Clean up manual refcounting of compilation unitsSimon Hausmann2018-02-061-3/+0
| | | | | | | | | | | | | | | | Replace manual use in QQmlData and QQmlData::DeferredData with QQmlRefPointer. Due to forward declaration trouble this required declaring a non-inline constructor/destructor for QQmlData and DeferedData and disabling copying, so that not every C++ compilation unit including qqmldata_p.h needs to instantiate the QQmlRefPointer destructor and thus know whether QV4::CompiledData::CompilationUnit has release(), etc. The out-of-line declarations however should not have any negative impact as the only call sites are within qqmlengine.cpp, too. Change-Id: I2e8295cb0d7f876a5d7d18765dbac285184e6c99 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Allow for currentQmlContext to be inlinedErik Verbruggen2018-01-181-5/+2
| | | | | Change-Id: Ic2a98a3a4b4362036222df05a92c0bed633c1d1c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Prevent a QVector detachErik Verbruggen2018-01-171-1/+1
| | | | | Change-Id: Ibda07de7a83cf9a1434532c485583b8b49b0a605 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Revert "Allow canceling incubation"J-P Nurmi2018-01-171-15/+0
| | | | | | | | | | | This reverts commit ca6b787a01ea289bd5c2a3e4ff3c7442a4ff58fc. This internal API was added as a workaround for Qt Quick Controls 2. It is no longer needed now that Qt Quick Controls 2 are using deferred execution. Task-number: QTBUG-50992 Change-Id: Iaddf22460f091743e1a68acd16813a28f3e82ecb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use potentially intercepted URL as ID for compilation unitsUlf Hermann2017-12-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | We generally have to pass a URL and a file name everywhere because the logical URL might be something else than the actual file being loaded. For example a QQmlFileSelector might modify the URL to be loaded for a specific file. This resulting URL, however, should not be used to resolve further URLs defined in the file loaded that way. As we need to access QQmlTypeLoader::m_url as string more often now, cache it and avoid frequent translations between QUrl and QString. Furthermore, QQmlDataBlob's URLs are changed to follow the same semantics. The finalUrl is the one that should be used to resolve further URLs, the url is the one used to load the content, and subject to any redirects or interceptions. This changes the semantics of URL redirects. Previously a redirected URL was used as the base URL for furher URL resolution. This doesn't work because redirection occurs after interception and interception should not influence the resolution of further URLs. We now use the original URL as base URL for resolution of further URLs and rely on the server to redirect those, too. Task-number: QTBUG-61209 Change-Id: I93822f820bed2515995de3cb118099218b510ca4 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* More fine-grained deferred property executionJ-P Nurmi2017-11-251-8/+77
| | | | | | | | | | | | | | | | This allows Qt Quick Controls 2 to defer the execution of certain building blocks until needed. For example, a button control can defer its background item so that the default background is not executed at all when replaced by a custom background. First of all, this gives a massive performance boost for customized controls. Secondly, this avoids the most burning issue in QQC2, problems with asynchronous incubation ("Object destroyed during incubation"). Task-number: QTBUG-50992 Change-Id: If3616c9dac70e3a474a20070ad0452874d267164 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix execution of deferred propertiesJ-P Nurmi2017-10-181-4/+4
| | | | | | | | | | | When deferred properties were assigned in multiple contexts, only the outermost context was executed. Any deferred property assignments in other inner contexts were never executed. Collect the deferred data to a container to be able to execute them all. Task-number: QTBUG-63200 Change-Id: I88fab27c1f81b5188430ada086dcc19842507e99 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Get rid of the root object index variableSimon Hausmann2017-09-081-2/+2
| | | | | | | | This is a follow-up to the parent commit to remove the variable that is really a constant (zero). Change-Id: I8fc20027c5c7b871269b814cb8b93636e94be267 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crashes with closures created in QML componentsLars Knoll2017-09-061-1/+1
| | | | | | | | | | | | | | | When closures created inside QML components are called after the surrounding component (and consequently QML context) has been destroyed, we are in a somewhat limited environment. Initially we would just crash as the calling QML context is not valid anymore. We can alleviate that by introducing reference counting on the context and letting the QML context wrapper keep a strong reference. This avoids the crashes and also ensures that at least imports continue to be accessible within these contexts (as the singleton test case demonstrates). Task-number: QTBUG-61781 Change-Id: I893f171842d01b0863d95a02ea738adc2620e236 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up void * usageLars Knoll2017-08-231-4/+5
| | | | | | | | Don't use void * in our internals, when we can simply pass a typed pointer. Change-Id: Id02033c7e66df7e041c079d3546f9dd6027ef8d5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Move the engine pointer from the property cache to the VME meta objectLars Knoll2017-08-021-1/+1
| | | | | | | | | This is where it belongs, and it makes the PropertyCache independent of the engine used. Task-number: QTBUG-61536 Change-Id: I21c2674ee3e2895abd2418764d140b154b47b868 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use QQmlType by valueLars Knoll2017-08-021-17/+17
| | | | | | | | | | | QQmlType is now refcounted, and we need to use it by value, to control it's lifetime properly. This is required, so we can clean up the QQmlMetaTypeData cache on engine destruction and with trimComponentCache() Task-number: QTBUG-61536 Change-Id: If86391c86ea20a646ded7c9925d8f743f628fb91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-111-1/+3
|\ | | | | | | Change-Id: Ib3d81ad33a6ba28d891da91271a64d5fcc4874e6
| * Avoid access to declarativeData when isDeletingChildren is setBernhard Übelacker2017-04-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QObject's members declarativeData and currentChildBeingDeleted share the same memory because they are inside a union. This leads to a problem when destructing mixed Widgets and QML objects. Then in QObjectPrivate::deleteChildren the member currentChildBeingDeleted is set. But unfortunatley QObjectWrapper::destroyObject retrieves the same pointer via declarativeData. This patch should avoid this by disallowing retrieval of declarativeData when isDeletingChildren is set (or at least adds a Q_ASSERT). Task-number: QTBUG-57714 Change-Id: I9ee02f79be3e8226c30076c24859b49b8dcfaecf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | qml: Rename importCache vars to typeNameCacheRobin Burchell2017-01-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This better reflects what it is, and especially removes some confusion in QQmlTypeCompiler which has a m_importCache member (of type QQmlImports), which lead to some strange-to-read things like this: m_importCache.populateCache(*importCache); Which is now: m_importCache.populateCache(*typeNameCache); Change-Id: I7590dd1ba71ca77a8d964250a0d517156b723f8e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Allow canceling incubationJ-P Nurmi2017-01-241-0/+15
|/ | | | | | | | | | | | Qt Quick Controls must avoid destroying any object that belongs to a tree of objects being incubated. The problem is that QQC have no control over the incubation process. This patch adds private API that allows QQC to cancel incubation of a specific item that QQC would like to destroy. Change-Id: Id9f9004736e2b53fe46cdb6bb3055b7457def94d Task-number: QTBUG-50992 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML tooling: Make sure we signal object creation also from QQmlIncubatorUlf Hermann2017-01-111-0/+13
| | | | | | | | | | | | We have to call the QQmlEngineDebugService back from QQmlObjectCreator rather than QQmlComponent, as there are more ways to create an object. We also add the new instance to the global instance list if only the V4 debug service is active, as both QQmlEngineDebugService and QV4DebugService use it. Change-Id: I5dcc71b2e91049bc19ec70d7b87959a61c9b6b75 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Pass a QV4::Function to the QQmlBoundSignalExpression constructorLars Knoll2016-12-091-2/+1
| | | | | | | And avoid the creation of a temporary FunctionObject Change-Id: Idaacfd978ac4ee26960bdf185272cc44d6618a71 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Avoid the creation of a FunctionObject for most bindingsLars Knoll2016-12-091-3/+3
| | | | | Change-Id: Ia62d380945250015009d9c2b6ed65f6d830277ef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Minor cleanupLars Knoll2016-12-091-5/+6
| | | | | Change-Id: I091f2de77f84fb298404dc8784defcf3a812d56a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8.0' into 5.8Lars Knoll2016-12-071-1/+1
|\ | | | | | | Change-Id: I19804e880005c66880eeabfaebf0b1093de80e6b
| * Fix caching of the current qmlContext in QQmlObjectCreatorLars Knoll2016-11-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | A context is not a QV4::Object, just a QV4::Managed. Testing for Object here lead to us creating a new QV4::QmlContext every time this method got called instead of sharing it. Reduces memory consumption and improves the performance of some of the creation benchmarks in qmlbench by ~20%. Change-Id: I20c0ad52133aa0cb40c9d2551fd635bef8b7d90a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Start cleaning up the QmlContextWrapperLars Knoll2016-12-041-2/+1
| | | | | | | | | | | | | | | | | | The class should get merged with the QV4::QmlContext class. Simplify the cleanup by moving both classes into a common file. Change-Id: I0074da79701d5f41eb51681b70fcde85bfd45fc1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Cleanup Value::isObject/objectValue usagesLars Knoll2016-11-291-1/+1
| | | | | | | | | | | | | | | | Try to avoid calling both as objectValue() already checks isObject(). Change-Id: I1d770d4d9dabed4ea4cc3e322b8fdc5a64f5bd2b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Get rid of most QT_NO_FOO usagesLars Knoll2016-11-291-2/+2
|/ | | | | | | | Instead use QT_CONFIG(foo). This change actually detected a few mis-spelled macros and invalid usages. Change-Id: I06ac327098dd1a458e6bc379d637b8e2dac52f85 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* QML: Obliterate QQmlAccessorsErik Verbruggen2016-08-301-1/+0
| | | | | Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-171-5/+5
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h src/qml/qml/qqmlobjectcreator.cpp Change-Id: I8bb7fe773d657f908f20ee5e72c2b9bd643f6260
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-5/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h tests/benchmarks/qml/qqmlimage/qqmlimage.pro tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp Change-Id: Iad11ce7fdf0c6d200fdebc16a94081bd8069a87a
| | * QQmlObjectCreator: prefer initializer syntax over assignmentEdward Welbourne2016-08-111-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | Greater uniformity; also opens the door to potential const-ing, should this ever be worht considering. Change-Id: I91b44472cb7d84f85b3033f14a763beeea837459 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * QQmlObjectCreator: initialize _bindingTargetEdward Welbourne2016-08-111-0/+1
| | | | | | | | | | | | | | | | | | | | | Coverity (CID 163180) noticed _bindingTarget wasn't initialized. Change-Id: Ia727d00a161e514c437a72084b6ef01a7ebf4abc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Make all fields in QQmlPropertyRawData privateErik Verbruggen2016-08-101-44/+44
| | | | | | | | | | | | | | | | | | | | | | | | And add accessors. This makes it easier later on to change the storage of the fields. Change-Id: I21163668ac83a7d52f398981baf3c27ef161c177 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Split off value type information from property dataErik Verbruggen2016-08-091-20/+32
| | | | | | | | | | | | | | | Change-Id: I2ae2fb0f18af9b866cc9482fd4f42d9d4269f8cb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Introduce QQmlPropertyIndexErik Verbruggen2016-08-041-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | This helps in making it clear when an index is a plain old number and when it consists of an encoded value type index. Change-Id: Ic50d95caf244ed0ee2d62bdba53910a371cfee04 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Reduce the amount of malloc calls when instantiating objectsSimon Hausmann2016-08-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For regular Qt types we currently perform three mallocs, one for the public class, one for the private and one for the declarative data. The latter we can fold quite easily into the malloc of the public class. The plan for the private is a bigger separate one ;-) Change-Id: I69973652ba70a4a238b491dff3d47a9db9a226f1 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-021-0/+24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/quick/items/qquickshadereffect.cpp 5.7 had a bug-fix in code dev has replaced wholesale. src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h One side changed a method's signature; the other side renamed a method declared adjacent to it and changed some code using it, moving some from the public class to its private partner. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side added a blank line before a comment the other re-wrote. Kept the re-write, killed the stray blank. .qmake.conf Ignore 5.7's change to MODULE_VERSION. src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmlpropertyvalidator.cpp 5.7 changed code in the former that dev moved to the latter. Reflect 5.7's changes there, adapted to dev's form. src/qml/qml/qqmlobjectcreator.cpp One side added new QVariant types; the other changed how it handled each type of QVariant (without git seeing any conflict); adapted the new stanzas to work the same as the transformed ones. tests/manual/v4/test262 dev had a broken sha1 for it; so used 5.7's 9741ac4655808ac46c127e3d1d8ba3d27ada618e Change-Id: I1fbe2255b97d6ef405cdd1d0cea7fab8dc351d6f
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-0/+26
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp tests/auto/quick/qquickitem/tst_qquickitem.cpp Change-Id: If261f8eea84dfa5944bb55de999d1f70aba528fd
| | * Fix string property assignments to 2d vectors and quaternionsSimon Hausmann2016-07-211-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Just like it's possible to assign "1,2,3" to a QVector3D, the same should be possible for a QVector2D and a QQuaternion. Task-number: QTBUG-54858 Change-Id: I8f394279dcdf5c057876efaa316b4bad51a4c126 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Cleanup: Move ResolvedTypeReference(Map) one scope upSimon Hausmann2016-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The class is a candidate for further functionality, it doesn't have to be nested in CompilationUnit. Change-Id: I100553160f5ae34f66b9f8ff5df9f636da2ffb67 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Remove some unused members on -no-qml-debugUlf Hermann2016-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | It's debatable if the uglification is worth the overhead of a few pointers. Change-Id: I63b55b2043b8752a94d4b862c3892915135a72b7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Replace debugger and profiler with stubs on -no-qml-debugUlf Hermann2016-07-281-3/+6
| | | | | | | | | | | | | | | Change-Id: I0f029d92366b3b508bf024c67b877a14bae27cd6 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Unify property reads/writes and use accessorsErik Verbruggen2016-07-251-96/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pass property reads/writes through utility functions in QQmlProperty, which in turn will try to use accessors when available (and no interceptors have to be called). Change-Id: I60ecfc202b6024bfe4a33206a46299787b152546 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Revert "QML: When available, use QQmlAccessors to read properties."Simon Hausmann2016-07-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f6fee09942de7901a708c4e16db0c7c82550e8c5. The accessor pointers were embedded in the generated machine/byte code, which makes it non-relocatable. As discussed, for the moment the ability to have relocatable code is prioritized. But the goal is to re-enable accessor accelerated property access through lookups. Change-Id: I18ec9ce31901c1fae3e58ac0c41bc87791e8c380 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix endian support in compiled data structuresSimon Hausmann2016-07-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to make the compiled data structures persistent on disk. In order to make it possible to create these data structures on a "host" system that may have a different endianness than the target system, we now make all the word sized fields little-endian. The template wrappers from QJson provide zero-overhead access for little-endian machines (the vast majority) while maintaining a large degree of source compatibility. Change-Id: I3d30da1fcf3bffb98dbe9337d3a35482fb7b57c8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QML: Use write accessors when setting constant binding values.Erik Verbruggen2016-07-111-10/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bindings with constant values like: Item { x: 10 } Setting these values is now also done through write accessors. On x86_64 QQmlObjectCreator::setPropertyBinding goes from ~7600 instructions to ~3600 (according to valgrind). Change-Id: I6a9ecfcd21c7b115828df3f235c292675ea9efc5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QML: Specialize bindings based on target property type.Erik Verbruggen2016-06-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we can determine the type of a target property during type compilation, we can skip a whole bunch of code that deals with converting the result of a binding to the correct (target) type. This removes 65 instructions on x86 for such typed bindings. Change-Id: Id2c7c57b9ae6dfbeb921121beae9630604ca1d17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Clean up property cache array handlingSimon Hausmann2016-06-161-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QQmlPropertyCacheVector in the CompilationUnit encapsulates the property caches for the objects declared in the QML tree as well as the bits indicating whether a VME meta-object is needed. The ref-counting for the caches in that vector was done "manually" and thus error prone. This patch replaces the vector with a wrapper container that has explicit move semantics and takes care of the addref() and release() calls upon insertion, replacement and destruction. Change-Id: If805fe016f1a1c70e56f8a90909ab87b653ea026 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Minor refcounting cleaningSimon Hausmann2016-06-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | Replace manual reference counting with automated counting, which is less error prone. Change-Id: I6a133bf9610f0d789f745b3cc1f0016e670a9525 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Remove QQmlCompiledData in favor of QV4::CompiledData::CompilationUnitSimon Hausmann2016-06-011-45/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | QQmlCompiledData used to contain the binary data for instantiating QML types in the QML VME. Nowadays the QML type compiler as well as the JavaScript compiler create a QV4::CompiledData::CompilationUnit. Change-Id: I155f62a5ecfb55a3fe230520231b6d8fd5b28ac9 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | | Remove inheritance of QQmlCompiledData from QQmlCleanUpSimon Hausmann2016-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The clear() re-implementation from QQmlCleanUp was empty, so this added no functionality. Commit 19c6f620dd35916466c36234231d798f79732ab0 removed the last usage of it. Change-Id: I499a6daeb1f74cc8bad1cacc5c367fde1e6eee75 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>