aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Changed value type property index encodingSimon Hausmann2014-12-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | We used to encode property index and value type property index in one int with 16 bits each, for example font.pixelSize with index of "font" in the lower 16 bits and "pixelSize" in the upper 16 bits. Detecting if a given encoded index was using value types or not was based on whether the value type index (upper 16 bits) were non-zero. That assumption holds given that all valid property indicies of value types are > 0 because they are all sub-classes of QObject, which provides the first property (objectName). With the introduction of gadgets property index zero will become popular again, and value types are a core use-case for gadgets. Therefore we need to change the encoding to allow for zero to be a valid value type property index. This is implemented by centralizing all decoding call sites to call one function that indicates -1 as non-present value type core index return value. That way we can encode the index with an offset of 1. Change-Id: I266abf140211a4f7204b47b94d07c364f0a8f408 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Store Heap objects in the qml binding wrapperLars Knoll2014-11-121-2/+4
| | | | | Change-Id: I7fae0710d148a2b07ec5f36a7fb96c2b645e564e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QQmlExpression/QQmlScriptString/QQmlBinding crashesSimon Hausmann2014-10-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | In the QQmlScriptString we store the binding id and it is an index into the runtimeFunctions array of the compilation unit. However we don't store the compilation unit and instead in QQmlBinding and QQmlExpression try to retrieve it from the cache via the context url (we have the context after all). That turns out to be not a reliable way, as sometimes the URL might slightly differ from the originally compiled cache (qrc:/// turning to qrc:/ maybe). Consequently the type is (unnecessarily) compiled again and unfortunately not _linked_, therefore the runtime functions array is empty. Another option is that when the component was created from a QByteArray, then no entry exists in the cache in the first place. This patch addresses the problem by storing a reference to the compilation unit in the QQmlContextData. That we can safely retrieve and it'll make sure the compilation unit also stays alive. In the process of that the manual reference counting was switched over to QQmlRefCount and QQmlRefPointer for QV4::CompilationUnit. Task-number: QTBUG-41193 Change-Id: I9111f9a3b65618e453954abcd789c039e65a94f7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Select specific features to be recorded when profiling QMLUlf Hermann2014-09-111-1/+1
| | | | | | | | | | | | Some features, like the memory profiler, create huge amounts of data. Often enough, we're not actually interested in all the data available from the profiler and collecting it all can lead to excessive memory consumption. This change enables us to optionally turn various aspects of QML profiling off. Task-number: QTBUG-41118 Change-Id: I7bb223414e24eb903124ffa6e0896af6ce974e49 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Merge remote-tracking branch 'origin/5.3' into 5.4Simon Hausmann2014-08-261-5/+13
|\ | | | | | | | | | | Conflicts: src/qml/qml/qqmlobjectcreator_p.h Change-Id: I60858ddb46866a8fa1a8576bb05b412afeeb4e41
| * Fix crash with early QObject property accessSimon Hausmann2014-08-251-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the reported bug, it can happen that we try to access the compile-time resolved QObject property of an object that is referenced by id. The binding that uses this is triggered when the property changes but _also_ when the id referenced object gets either created or deleted. The first time the binding is evaluated is very early on, when the id referenced object is not created yet, so the binding evaluation fails. However the dependency is set up, and so later then the id referenced object is created and the id property is set on the context, the notification triggers and the binding is re-evaluated. During that binding evaluation a QObject property access happens by index on an object that doesn't have its VME meta-object set up yet. Therefore the property access fails and a crash occurs or the Q_ASSERT(property) assertion fails. The fix is to set register the id named object in the context _after_ the VME meta-object is setup. Task-number: QTBUG-40018 Change-Id: Ic2d7b4a0c49635efe68e93f2f6c316eb65f0c309 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Update license headers and add new licensesJani Heikkinen2014-08-251-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* | CleanupSimon Hausmann2014-08-151-25/+25
| | | | | | | | | | | | | | | | | | Merge QV4::CompiledData::QmlUnit into QV4::CompiledData::Unit. For pure JS units it means a slight increase of memory usage by a few bytes, but overall it makes the code a lot simpler. Change-Id: Ib48927749720b056f004aac0fe22cb8ec729e3f6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-291-6/+21
|\| | | | | | | Change-Id: Id95f7b01de36bccecbb7b73acc041654a1fe2ebe
| * Fix interaction of garbage collector with JS objects during QML type ↵Simon Hausmann2014-07-261-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instantiation It may happen that during the lengthy process of instantiating a tree of objects for QML, the garbage collector runs. For objects created by QML we support different ownership models, for example in QtQuick visual parents keep their visual children alive, despite perhaps a lack of QObject parentship. That ownership becomes active once the QML autoparent function has assigned the correct visual parent, which happens after object instantiation (after QQmlObjectCreator). Similarly when a composite type is created, its QObject parent is only set after all properties have been set. The root QObject is kept alive through a special boolean, but if the sub-objects aren't children yet, their JS wrapper might get deleted. For composite types with var properties, that also means their var properties get deleted, such as the model property of TableView.qml in the bug report. In the future we want to support creating QWidget hierarchies with QML, which also for layouts may rely on a delayed parent assignment for layouts. To accommodate all this, this patch introduces an array on the JS stack that keeps track of all JS wrappers for all QObjects created. This array is alive during object tree creation. Afterwards, the different ownership models take over, for example the auto parent function assigning a visual parent. This patch also fixes an off-by-one in the total object count calculation for composite types, where when instantiating a composite type as a sub-object we counted the sub composite's object count but forgot the object itself. Task-number: QTBUG-38835 Task-number: QTBUG-39966 Change-Id: I6104b2434510642081e0c54793ed296adeca7481 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Change the object allocation schemeSimon Hausmann2014-07-221-2/+2
| | | | | | | | | | | | | | | | | | Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | New construction scheme for the binding wrapperLars Knoll2014-07-221-2/+2
| | | | | | | | | | Change-Id: Ic248aef22e1222e84dfb9b8af0413cf750beb576 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-021-5/+21
|\| | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/quick/scenegraph/openglunderqml/squircle.h src/quick/doc/src/qmltypereference.qdoc src/quick/scenegraph/qsgthreadedrenderloop.cpp Change-Id: Ife4f4b897044a7ffcd0710493c6aed1d87cf1ef9
| * Fix crash when deleting component in Component.onComplete through loaderSimon Hausmann2014-06-231-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a regression introduced with Qt 5.3.0. The recursion watcher code that is supposed to handle the test case of QTBUG-39775 can detect the recursion into the object creator. However the boolean that indicates the recursion is a member of a structure that's deleted afterwards. To avoid access to deleted memory, this patch simply reference counts data structure shared between the creators and also wraps the recursion watcher into a convenience class that also increases/decreases the reference count accordingly. Change-Id: I8d2e3e200ab1295e89d951e09f187d382a056d5a Task-number: QTBUG-39775 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * QQmlObjectCreator: Clear sharedState componentAttached in destruction/clearAlbert Astals Cid2014-06-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes crash when delegate is being deleted while not totally instantiated Valgrind trace: ==15748== Invalid write of size 8 ==15748== at 0x57A02DB: QQmlComponentAttached::~QQmlComponentAttached() (qqmlcomponent.cpp:985) ==15748== by 0x57A0318: QQmlComponentAttached::~QQmlComponentAttached() (qqmlcomponent.cpp:989) ==15748== by 0x668736B: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66900EB: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1D4B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==15748== by 0x5D33AE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() (qqmlprivate.h:106) ==15748== by 0x668736B: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66900EB: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1D4B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==15748== by 0x5D34655: QQmlPrivate::QQmlElement<QQuickLoader>::~QQmlElement() (qqmlprivate.h:106) ==15748== by 0x668736B: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66900EB: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1D4B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==15748== by 0x5D33AE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() (qqmlprivate.h:106) ==15748== by 0x668736B: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66900EB: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1D4B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==15748== by 0x5D348A5: QQmlPrivate::QQmlElement<QQuickFocusScope>::~QQmlElement() (qqmlprivate.h:106) ==15748== by 0x668736B: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66900EB: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1D4B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==15748== by 0x5D34655: QQmlPrivate::QQmlElement<QQuickLoader>::~QQmlElement() (qqmlprivate.h:106) ==15748== by 0x668736B: QObjectPrivate::deleteChildren() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66900EB: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1D4B5: QQuickItem::~QQuickItem() (qquickitem.cpp:2064) ==15748== by 0x5D33AE5: QQmlPrivate::QQmlElement<QQuickItem>::~QQmlElement() (qqmlprivate.h:106) ==15748== by 0x6689607: QObject::event(QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x5D1B012: QQuickItem::event(QEvent*) (qquickitem.cpp:7114) ==15748== by 0x6659CDC: QCoreApplication::notify(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66599D4: QCoreApplication::notifyInternal(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x665B826: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66B1242: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x8EE2E43: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4100.0) ==15748== by 0x8EE3087: g_main_context_iterate.isra.24 (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4100.0) ==15748== by 0x8EE312B: g_main_context_iteration (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4100.0) ==15748== by 0x66B06BB: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66578EA: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x665EF45: QCoreApplication::exec() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x40711B: startShell(int, char const**, void*) (main.cpp:171) ==15748== by 0x407A74: main (main.cpp:227) ==15748== Address 0x1be83870 is 64 bytes inside a block of size 112 free'd ==15748== at 0x4C2C2BC: operator delete(void*) (vg_replace_malloc.c:503) ==15748== by 0x5815FB0: QQmlObjectCreator::~QQmlObjectCreator() (qqmlobjectcreator.cpp:156) ==15748== by 0x57A52AA: QQmlIncubatorPrivate::clear() (qscopedpointer.h:62) ==15748== by 0x57A53C6: QQmlIncubator::clear() (qqmlincubator.cpp:577) ==15748== by 0x5DCEA20: QQuickLoader::setActive(bool) (qquickloader.cpp:350) ==15748== by 0x5DCF6D2: QQuickLoader::qt_metacall(QMetaObject::Call, int, void**) (moc_qquickloader_p.cpp:277) ==15748== by 0x579DC66: QQmlPropertyPrivate::write(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) (qqmlproperty.cpp:1322) ==15748== by 0x579E76E: QQmlPropertyPrivate::writeValueProperty(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) (qqmlproperty.cpp:1246) ==15748== by 0x579F2F9: QQmlPropertyPrivate::writeBinding(QObject*, QQmlPropertyData const&, QQmlContextData*, QQmlJavaScriptExpression*, QV4::ValueRef, bool, QFlags<QQmlPropertyPrivate::WriteFlag>) (qqmlproperty.cpp:1578) ==15748== by 0x580CF69: QQmlBinding::update(QFlags<QQmlPropertyPrivate::WriteFlag>) (qqmlbinding.cpp:266) ==15748== by 0x580D5BD: QQmlBinding::expressionChanged(QQmlJavaScriptExpression*) (qqmlbinding_p.h:105) ==15748== by 0x57E6156: QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) (qqmlnotifier.cpp:81) ==15748== by 0x57E6130: QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) (qqmlnotifier.cpp:76) ==15748== by 0x57E6130: QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) (qqmlnotifier.cpp:76) ==15748== by 0x5788FA3: QQmlData::signalEmitted(QAbstractDeclarativeData*, QObject*, int, void**) (qqmlengine.cpp:721) ==15748== by 0x6688232: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x57882A7: QQmlData::destroyed(QObject*) (qqmlengine.cpp:1658) ==15748== by 0x668FD7D: QObject::~QObject() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x55E8B64: QQmlDMAbstractItemModelData::~QQmlDMAbstractItemModelData() (qqmladaptormodel.cpp:95) ==15748== by 0x58643DC: QQmlDelegateModelPrivate::release(QObject*) (qqmldelegatemodel.cpp:520) ==15748== by 0x586440C: QQmlDelegateModel::release(QObject*) (qqmldelegatemodel.cpp:536) ==15748== by 0x5DFED4F: QQuickItemViewPrivate::releaseItem(FxViewItem*) (qquickitemview.cpp:2349) ==15748== by 0x5DBAB94: QQuickGridViewPrivate::addVisibleItems(double, double, double, double, bool) (qquickgridview.cpp:497) ==15748== by 0x5DFC94E: QQuickItemViewPrivate::refill(double, double) (qquickitemview.cpp:1751) ==15748== by 0x5DFF26A: QQuickItemViewPrivate::layout() (qquickitemview.cpp:1859) ==15748== by 0x5D275F7: QQuickWindowPrivate::polishItems() (qquickwindow.cpp:271) ==15748== by 0x5D02B7D: QSGThreadedRenderLoop::polishAndSync(QSGThreadedRenderLoop::Window*) (qsgthreadedrenderloop.cpp:1150) ==15748== by 0x5D03167: QSGThreadedRenderLoop::event(QEvent*) (qsgthreadedrenderloop.cpp:1235) ==15748== by 0x6659CDC: QCoreApplication::notify(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66599D4: QCoreApplication::notifyInternal(QObject*, QEvent*) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66B00CC: QTimerInfoList::activateTimers() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66B03F0: ??? (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x8EE2E43: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4100.0) ==15748== by 0x8EE3087: g_main_context_iterate.isra.24 (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4100.0) ==15748== by 0x8EE312B: g_main_context_iteration (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4100.0) ==15748== by 0x66B06BB: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x66578EA: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x665EF45: QCoreApplication::exec() (in /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.3.0) ==15748== by 0x40711B: startShell(int, char const**, void*) (main.cpp:171) ==15748== by 0x407A74: main (main.cpp:227) Change-Id: I2c7d38fa5a2566520173bff7ad4e5f9c966d083e Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Cleanup: Get rid of the url and file name members in QQmlCompiledDataSimon Hausmann2014-06-051-6/+6
| | | | | | | | | | | | | | | | This is part of the effor of moving members from QQmlCompiledData into QV4::CompilationUnit in order to eliminate the former in the long run. Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devSimon Hausmann2014-06-041-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | The merge conflict is about the removal of "d1" from the register set on ARM, but that was already done in dev in commit ddb33ee9ba9e1344caa9be5dbf4b534c3ede692e The change in src/quick/scenegraph/coreapi/qsgrenderer.cpp with commit 2414f1675eab163b22dcc4e8ded80ed04d06369b was reverted to what it was before, per Laszlo's advice. Conflicts: src/qml/jit/qv4isel_masm.cpp Change-Id: I7bce546c5cdee01e37853a476d82279d4e72948b
| * Fix crash (failing assertion) when declaring a non-string id propertySimon Hausmann2014-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This isn't very useful QML, but the following was "legal" in 5.1: property int id: id: foo The integer property was not set, but the object's name (id) was still set. With 5.3 this causes a failing assertion, which shouldn't happen. We should do the same thing as the old code in QQmlComponent::buildProperty did for id properties: Set them only if they're of string type. Task-number: QTBUG-38463 Change-Id: I0da58557fbfb0944f53127e0ee77117ac33ce250 Reviewed-by: Tasuku Suzuki <stasuku@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Rework custom parser integrationSimon Hausmann2014-06-041-4/+13
|/ | | | | | | | | | | | | | | | | | | | | | | The custom parser design used to be so that the custom parser operates on the "AST", creates its own binary representation of the data it needs, stores it in a QByteArray and gets that at object instantiation time. That meant serializing everything necessary. With the introduction of the "binary" QML data structure, that process of serialization becomes obsolete and would require extra work in the custom parsers for example for QQuickStates to store the translation parameters. The clean solution is to eliminate this unnecessary serialization process and instead let the custom parsers do a verification pass at type compile time and then simply operate directly on the QV4::CompiledData::Bindings at object instantiation time. That simplifies the code, and allows for support of translations throughout all list model properties. Additionally this speeds up the creation of state objects and reduces memory consumption. Previously a text: qsTr("foo") binding in states would result in an actual java script binding. After this patch it is merely stored as a string and translated at object instantiation time. Change-Id: I7550274513f54abb09a0ab4de51c4c0bcdb23cae Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use RAII for VME profilerUlf Hermann2014-04-031-18/+17
| | | | | | | | | | | | | | Now that object creation is done in nested function calls we can use an RAII-type profiler to trace it. This makes the profiling much simpler and more robust. Also, the stack of profiling data in the VME profiler has to match the stack of completion callbacks in the VME, so the push and pop operations are synchronized now. Task-number: QTBUG-37978 Change-Id: I1bc5e0665b88e5b3772e48c8676cdda3fae59e1b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Avoid recompiling of signal handlers defined in QtQuick state changes and ↵Simon Hausmann2014-04-021-1/+1
| | | | | | | | | | Connection objects We can re-use the expression we've compiled at QML type compilation time, as long as we "inject" the signal parameters in the dynamic qml lookup chain. Change-Id: Icc417531c41dea06ff5d033011179af49b03f542 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix compilation of script stringsSimon Hausmann2014-04-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The right hand side of script string properties can be evaluated in entirely dynamic scopes, due to QQmlExpressions' public API of allowing construction from a QQmlScriptString and a variable scope/context. Nevertheless we should compile these bindings at type compile time, as long as we make sure that the compiled code doesn't try to do any compile time determined property lookups and type resolution. This is implemented using a separate compilation pass that ensures the disableAcceleratedLookups flag is set. A few minor cleanups come with this patch: * Ensure that the property caches array is always symmetric to the list of compiled QML objects, as that allows the use of at() instead of value(). * The code for creating a QML callable function object for a given run-time function is now centralized in a static function QmlBindingWrapper, used for script strings and bindings from custom parsers. The provided unit test verifies the successful execution of the same script string with two different scope objects. Change-Id: Ica2cea46dd9e47263b4d494d922d3cc9664b08ae Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix typoSimon Hausmann2014-04-011-2/+2
| | | | | | | creatScriptFunction -> createScriptFunction Change-Id: Icdb9214b1ae067fa2b8693d50cdac0be9fe6d390 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix performance regression of parent setting during QML object creationSimon Hausmann2014-03-311-2/+1
| | | | | | | | | | This showed up in the profiles again: In QML we create a lot of objects with many children and sending a child event each time is expensive. That's why the VME didn't do that and hadn't done so in ages. This patch restores that behavior and aspect of loading performance. Change-Id: I5078fe330d913dc832b284aaecf031152dc80802 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanupsv5.3.0-beta1Simon Hausmann2014-03-211-2/+2
| | | | | | | | | * Get rid of members in QQmlCompiledData that were used by the VME and are now unused * Get rid of QQmlVME friend declarations that are not needed anymore Change-Id: I11b4b6f0b4b0b60edf92a1256be3d0d44d76bbc9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Namespace cleanupSimon Hausmann2014-03-171-1/+1
| | | | | | | Move the QML IR types into the QmlIR namespace and clean them up. Change-Id: I2125449e5a519034e23670651efa620f405730b4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crash with lazy binding initialization and compile time calculated ↵Simon Hausmann2014-03-171-4/+7
| | | | | | | | | | | | | dependencies During lazy binding initialization we may execute bindings where we calculated dependencies to the context object at compile time. In order to register those dependencies, the contet object needs to be set in the QQmlContextData. This patch makes sure to set it before setting up the bindings. Change-Id: Iacd360140cd9c389487bda82f6a7e6cc3a44c154 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crash on shutdown with statesSimon Hausmann2014-03-151-0/+1
| | | | | | | | | | | | When populating deferred properties, we must not set the rootObjectInCreation flags on the root context and (consequently) on any sub-objects objects created when initializing deferred properties. Doing so otherwise will end up us incorrectly linking QQmlContextData together, causing QQmlData::linkedContext to point to iself and crash on exit upon deletion. Task-number: QTBUG-37484 Change-Id: Ia5dc92a04e0f66499f15fbac10f14859d387b021 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix property caches out of sync with grouped properties that have a VME meta ↵Simon Hausmann2014-03-131-30/+17
| | | | | | | | | | | | | | | | | | | | | | object Because QQmlObjectCreator::populateInstance would take the property cache to install from the outside and also pass it as the cache to use for the VME meta object to install, it could happen that the wrong cache was installed - the one supplied by engine->cache(propType) instead of the cache created together with the VME meta-object at type compilation time. This patch ensures that they're always in sync and correct by removing the responsibility of the caller to supply the cache to use and install. Instead the function will always use the cache calculated at type compile time (and also use that when installing the VME meta object). Installation of the property cache on the declarative data of the instance is now done only at createInstance() time, which fortunately also simplifies the code. Change-Id: Ia722cd57bc48007aaf725f1f59daa2f21569e324 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove redundant QQmlBinding members.Michael Brasser2014-03-111-2/+1
| | | | | | | | | This reduces the size of QQmlBinding by 12 bytes. Task-number: QTBUG-37134 Change-Id: Id55257edec8cee88d863374e8a96d7eebbeaf523 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Add support for resolving translation bindings at compile timeSimon Hausmann2014-03-111-3/+3
| | | | | | | | | | Simple calls to qsTr and qsTrId are detected at type compile time and reduced to a special Translation and TranslationById binding type, which avoids allocating a QML binding at type instantiation type just to perform a translation. Change-Id: I61e4f2db2a8092b5e6870e174b832d9c20cd62b5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix incorrectly initialized property cache on group objectsSimon Hausmann2014-03-111-6/+11
| | | | | | | | | | | | When initializing bindings on group objects, we would accidentally set the property cache for the property type instead of preserving a possibly earlier initialized cache on the ddata of the QObject. Task-number: QTBUG-37390 Change-Id: I4d6a4ce6b3382f378f9a9ddfe11924860a15979d Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix crash in tst_qquickpathviewSimon Hausmann2014-03-061-1/+3
| | | | | | | | | | | | | QQuickPathView's attached object uses a dynamic meta-object. So when installing bindings - such as a signal handler - on it and we want to determine the property cache for it, we must not use the QQmlEnginePrivate::cache overload that takes a QObject pointer, as that will - rightly so - return a null pointer. Instead in this case it is okay to go with the static type overload, by using the meta-object of the attached type known at compile time. This is consistent with the VME code path. Change-Id: Iffc64f7ee4677c6cc60d071b80f4032cf8037ab7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix potential infinite recursion when using the incubatorSimon Hausmann2014-03-061-3/+3
| | | | | | | | | | Some auto-tests use the incubation controller with a one-step boolean, so shouldInterrupt() always returns true. When we're in the finalization phase enabling the bindings one-by-one, pop one off the bindings stack and enable it _before_ doing the shouldInterrupt() check. Otherwise we don't progress at all. Change-Id: Ibd5bbc253f8e8f74b08c91b018533c9e2735d2c8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix designer integrationSimon Hausmann2014-03-051-2/+2
| | | | | | | | If the QML puppet disables onComplete callbacks, we must obey that also in the new code path. Change-Id: Ic9b74c6a5ee04dc5b8e4f545a8e6cc0fa8dd28f1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Add support for deferred propertiesSimon Hausmann2014-03-051-2/+74
| | | | | Change-Id: I592518444ef353cfcf153df0e6afa2fbac613560 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix profiler supportSimon Hausmann2014-03-041-0/+16
| | | | | | | | | Add profiler tracing calls during objection creation and make sure to set the function token / source location correctly for the synthesized function declarations of signal handlers. Change-Id: Ie4f8accce3a5c5d1d57bb0646cda588b89b76718 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix some qqmlincubator testsSimon Hausmann2014-03-041-4/+43
| | | | | | | | | | | | | | | We need to track the objects created and pass them over to the VME guard used in the incubator. The incremental build nature of the incubator requires that to avoid crashes. For nested incubators we need to set the activeVMEData field in the root QQmlContext, to allow child incubators to locate the parent. Lastly we need can emulate most of the VME behavior in terms of build states when running with QQmlInstantiationInterrupt by presenting four build steps: The initial state, two build steps, a finalization step and the state when we're done. Change-Id: I16cd7f71744decb9d4735ec77e9d944fad18e88d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix tst_qqmlvaluetypesSimon Hausmann2014-03-031-2/+0
| | | | | | | | | | | | | | * Make sure to remove earlier set bindings for any value type property, not just scripts. We want font.bold: false to also override an earlier actual binding for example. * Propagate on assignments on qualified property names throughout the chain of bindings - that makes it easier to detect them early on. * The group property collection in the bindings validator should only include value bindings to group properties, not on assignments - as they can always appear in parallel. Change-Id: Ib7ec4de755a5a8d269324a77cba36eb945366274 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove nArguments and name from QV4::FunctionLars Knoll2014-03-031-1/+1
| | | | | | | | Saves 12 bytes per Function Change-Id: I9a495805f9201eb6162a520ff5c2defeb73dc37a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Michael Brasser <michael.brasser@live.com>
* [new compiler] Fix tst_qquickloader::deleteComponentCrash by introducing a ↵Simon Hausmann2014-03-031-3/+9
| | | | | | | watcher for self-deletion Change-Id: I809a4860831847ab61c7ca0ba302057ec165ee24 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Work around MSVC having issues with nested classes and templatesSimon Hausmann2014-03-031-2/+2
| | | | | | | Move SharedState into its own top-level structure. Change-Id: I0b6baeade57ff342df23672808d77933fa6ad26d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix warnings in qml list model custom parserSimon Hausmann2014-03-021-4/+6
| | | | | | | | For the warnings to have the correct column/line number information, we need to set it on the QQmlData before calling the custom parser. Change-Id: I6e1c729491df6af846e41ee88e785b32e4715751 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix for tst_qqmlconnectionsSimon Hausmann2014-03-021-7/+13
| | | | | | | | | | | | | Make sure to pass onFooChanged handlers to QQmlConnection's custom parser by not relying on the signal handler converter to set the IsSignalHandlerExpression flag. That should only be set for real signal handlers, the custom parser gets the raw bindings. Also don't try to initialize bindings at creation time the custom parser covers. Change-Id: Iae22bc886c312843136f073959e59da440f4184c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix QQmlPropertyMap testsSimon Hausmann2014-03-021-4/+8
| | | | | | | | | QQmlPropertyMap is treated as a type that cannot be cached with QQmlPropertyCache, doesn't allow for accelerated property access and also doesn't allow for declarations of any kind in sub-types. Change-Id: Id8a6811120aa61ffb5037394e758cc62501e0fc3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix tst_qqmlengine::trimComponentCacheSimon Hausmann2014-03-021-0/+2
| | | | | | | Fix bug in QQmlCompiledData refcounting. Change-Id: I09528419c602d3173db2f13c516d2f0d79abd92e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix tst_qqmlqt::createComponentSimon Hausmann2014-03-021-3/+3
| | | | | | | | | Initialize the binding's self-pointer before calling addObject(), as some funky tests try to delete the binding from within there and the self-pointer allows us to find out later that the binding was deleted. Change-Id: I8c9e3fe7304f304eace29c0631263b1ec021a8c4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Report an error when trying to append to a read-only listSimon Hausmann2014-03-021-0/+5
| | | | | Change-Id: I9c6d7f2f0983274ecb8b7cc15c0dbe21f3e0d58f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix property assignments to resolved enumsSimon Hausmann2014-03-021-8/+14
| | | | | | | | | | Force the type of the property to write to int, if we resolved the enum earlier at type compile time. This is consistent with the VME and allows for assignments to enum properties without a string converter. Fixes tst_qquickgridview in particular. Change-Id: Ic29f4a6115930bd7fff45f1658c00d0bfc24c7ec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Remove incorrect assertionSimon Hausmann2014-03-021-1/+0
| | | | | | | | | It is perfectly valid for example to do Behaviour on someColor.r Change-Id: I39961509b4698c19441f71baa4af197f633c5b39 Reviewed-by: Lars Knoll <lars.knoll@digia.com>