aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvmemetaobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Remove the less often used Ref classesLars Knoll2014-07-221-1/+1
| | | | | Change-Id: I9ee531c903317a0f324671d98af1f967b684915c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix typoSimon Hausmann2014-04-011-1/+1
| | | | | | | creatScriptFunction -> createScriptFunction Change-Id: Icdb9214b1ae067fa2b8693d50cdac0be9fe6d390 Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Fix crash when accessing var properties in objects with invalid contextSimon Hausmann2014-03-041-3/+4
| | | | | | | | | | | | | | | | | | We've had two indepedent reports of people running into the issue of their QML code accidentally trying to access var properties in item view delegates that were on the path of destruction, i.e. their QQmlContext was already marked as invalid. Any such access would cause a failing assertion in debug builds or a crash in release builds. This patch removes the dependency to QQmlContextData for accessing the var properties and adds a test-case that covers this use-case. This is a regression from Qt 5.1.x. Task-number: QTBUG-37227 Change-Id: Icf55d5fa8c15e45974e78086e9e11b2401ea9bad Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make the Ref classes not template basedLars Knoll2014-02-071-1/+2
| | | | | | | | | | Move to a class hierarchy that mirrors the main classes. This will allow moving functionality over into the Ref classes, as the current Managed classes become mainly something that holds the data. This is required to make objects movable by the GC. Change-Id: I4ca88ab0e5d8c88c8dc56d51937990500a33e0d9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename Referenced to ManagedRefLars Knoll2014-02-071-1/+1
| | | | | | | | | | First step of removing the templates here and turning this into a class hierarchy. This is required, so we can move all member methods into the Ref classes and make objects movable during GC. Change-Id: Ie14af07fd3e72a7d84a528d0042189ff12ba21bb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-21/+21
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Encapsulate the current context and fix it's usageLars Knoll2013-12-041-1/+1
| | | | | | | | | | | Encapsulate accesses to the current context, and rework the way we push and pop this context from the context stack. Largely a cleanup, but simplifies the code in the long term Change-Id: I409e378490d0ab027be6a4c01a4031b2ea35c51d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Refactor marking GC'ed objectsLars Knoll2013-11-051-4/+4
| | | | | | | | | | | Don't use recursive function calls anymore. Instead, push marked objects onto the JS stack, and then pop them off when their children are being marked. Should reduce stack memory usage, and improves performance by ~5%. Change-Id: I2d37d97579144fcba87ec8e9fd545dd220c01fbb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix crash in QObject tree destructionSimon Hausmann2013-10-311-1/+2
| | | | | | | | | | | This issue was discovered while running the QtQuick Controls auto-tests in valgrind. The issue is that the QObject based property in the VME meta object is deleted as a child, after its parent (that had the property) was deleted. At that point it's not safe anymore to emit the notify signal in the already-deleted object (m_target->object). Change-Id: I54e81dfedb6e712b8cbf182a72254e33e82910e3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix the remaining try/catch statements in C++Lars Knoll2013-10-291-4/+4
| | | | | Change-Id: I2421dc48fb271b66bd476fb16a32a88fcc4c5177 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Properly propagate parse errorsLars Knoll2013-10-291-1/+1
| | | | | | | | Replace all try/catch statements used when parsing with checks for engine->hasException. Change-Id: I4493cb600d5a3eb095c2003bb88bd031403e47c9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove internal method from public APILars Knoll2013-10-191-1/+1
| | | | | | | | QQmlError is public API and shouldn't expose an internal method. Change-Id: I7caf06af9340fefec5c96103395fe74acbf19497 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Compile JS functions as part of the QQmlCompiler run in the loader threadSimon Hausmann2013-10-111-14/+16
| | | | | | | | ...instead of extracting the function body as a string and compiling it in the GUI thread. Change-Id: I3c3108f6e35464b5581a2d8b5799e7285858ce4d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change exception handling APISimon Hausmann2013-10-021-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the exception handling API in the engine slightly, encapsulating any use of direct throw statements and catch blocks with concrete types. In the future we need to be able to change the way these are implemented, in order to ensure that the correct stack unwinding code is triggered for throw and re-throw. This patch separates the C++ exception object thrown from the V4 exception (that includes value, throwing context pointer) and stores the latter inside the engine. In order for that to compile, ExecutionEngine::StackTrace and StackFrame had to move into the QV4 namespace directly. In addition the syntax for catching exceptions changes from try { ... } catch (QV4::Exception &ex) { ex.accept(context); QV4::ScopedValue exceptionValue(scope, ex.value()); } to try { ... } catch (...) { QV4::ScopedValue exception(scope, context->catchException()); } Context::catchException() checks if there's a "current" exception in the engine, and if not assumes that we caught an unrelated exception and consequently re-throws. partiallyUnwind() is also gone and replaced with rethrowException(), in order to encapsulate the re-throw. Lastly, in the future nesting try/catch blocks isn't going to be possible due to limitations in the common C++ ABI with regards to foreign exceptions. Change-Id: Ic81c75b057a2147e3176d8e0b4d326c14278b47d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use SafeValue instead of Value in ScopedValue methodsLars Knoll2013-10-021-1/+1
| | | | | Change-Id: Ie463efe600d498ce77d4b9e8b48abcfd61c1ab78 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove most uses of Value from qml/qmlLars Knoll2013-09-301-6/+5
| | | | | Change-Id: I409a8505a9e01f86d777bc694d24516d1c8f0c4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Value::fromBool, ... to a new Primitive classLars Knoll2013-09-281-3/+3
| | | | | | | | This will simplify finding the remaining direct usages of QV4::Value that need fixing. Change-Id: I223099727436d5748027c84c53d9dfc4028e38ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move more API over to use ValueRefLars Knoll2013-09-261-2/+2
| | | | | Change-Id: I372f1f3e3e78d45912a913f437e622e0acfc9646 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix Persistent/WeakValue APILars Knoll2013-09-261-11/+19
| | | | | | | Don't use unprotected Values in the API anymore. Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert putIndexed()Lars Knoll2013-09-221-5/+11
| | | | | Change-Id: I7d02b0fdf45079d0f7afcfb6d3158dd60cb09f33 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Don't use Value::emptyValue() anymore.Lars Knoll2013-09-221-5/+5
| | | | | | | | | | emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert more methods to return a Returned<>Lars Knoll2013-09-181-1/+2
| | | | | Change-Id: If294c9c4f574824c308b63a11da1337226180105 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Convert most remaining return values from Value to ReturnedValueLars Knoll2013-09-181-13/+14
| | | | | Change-Id: If8b0c3b91be50678693868c10fefc3678008834d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::getIndexed()Lars Knoll2013-09-181-8/+11
| | | | | Change-Id: I0371ed21c4ef99564d3ffa1082dd109e890a78bf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename QV4::ValueScope to QV4::ScopeLars Knoll2013-09-181-1/+1
| | | | | | | | The class is going to be used all over the place, so let's give it a short name :) Change-Id: If61543cb2c885e7fbb95c8fc4d0e870097c352ed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Require a ValueScope for ScopedCallData as wellLars Knoll2013-09-181-1/+1
| | | | | | | | This brings things more in line with ScopedValue, and also simplifies cleanup of Scoped values. Change-Id: If5f1466b4e13c629d56c1e7c638937f61ba48f77 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Use a ReturnedValue for Managed::call()Lars Knoll2013-09-181-1/+2
| | | | | Change-Id: Ief2d75e9789dd367c603d90dc0fe5316a0d055e3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move CallData onto the JS stackLars Knoll2013-09-111-4/+5
| | | | | Change-Id: I22e853acfd2da337344b581bb0412c5f9930c510 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* change calling convention for JS function callsLars Knoll2013-09-021-3/+4
| | | | | | | | | | | | This allows faster pass through of the data if we have nested calls. Also make sure we always reserve at least QV4::Global::ReservedArgumentCount Values on the stack to avoid stack corruption. Change-Id: I42976460f1ef11a333d4adda70fba8daac66acf3 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Re-enable two disabled var property tests and make them passSimon Hausmann2013-06-151-0/+3
| | | | | | | | | When marking the var properties of a VME-metaobject (we decided to keep its QObject alive), then we must also mark the var properties of the parent VME-metaobject. The two property var inheritance tests verify that. Change-Id: If1f0d4f3daef78d42adb7052cc1ce7bbdd6da585 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move QV8QObjectWrapper::newQObject into QV4::QObjectWrapperSimon Hausmann2013-06-051-2/+2
| | | | | | | | ...where it is just called wrap(), because it doesn't always create a new JS wrapper for the QObject. Change-Id: Ieed0fc97174eb51cd04df0149e715c234a5822bd Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Cleanups in QObject bindingsSimon Hausmann2013-06-041-1/+1
| | | | | | | | | | | * Rename v8object to jsWrapper in QQmlData * Rename v8objectid to jsEngineId, as that's the identifier of the engine that currently owns the primary JS wrapper This is in preparation for moving newObject away from QV8QObjectWrapper Change-Id: I6432365e849d159600e22f09e7e2ab2ae2117db6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QV8Engine::toQObject and QV8QObjectWrapper::toQObjectSimon Hausmann2013-06-031-1/+1
| | | | | Change-Id: I8726148093079b3385c6b0f16284af0b5ba92066 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove last v8 dependency in qqmlvmemetaobjectLars Knoll2013-06-031-1/+4
| | | | | Change-Id: If3b45ea3048f6167a121011191aa5f42b2fe2e88 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Port QObject bindings to use new castSimon Hausmann2013-06-021-1/+1
| | | | | Change-Id: Ib0a8ba76df51276d53cf251b0ed979176e1fba01 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove some unused codeLars Knoll2013-05-311-3/+0
| | | | | Change-Id: Ie865cdf564e2562db7febbdef6b7bfa75e44859c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move Variant and QtObject over to new casting schemeLars Knoll2013-05-311-4/+4
| | | | | Change-Id: Ie9e5e40b4bea4d4379dc9bdd103852c32d6ae478 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroySimon Hausmann2013-05-311-1/+2
| | | | | | | | | | | | | | | | | | | When destructing the JS engine and deleting the JS wrappers, we may decide to delete the QObjects of JS owned JS QObject wrappers. During this phase (engine destruction) we need to delete the QObject instantly instead of deferred (the default when _running_ the engine). * Delete the memory manager first in the ExecutionEngine destructor, as some of the user code destructors we may end up calling still expect a somewhat functioning engine unfortunately. * Fixed also some bugs in Persistent/WeakValue: When assing a value, detach properly if refcount > 0 * Fixed a bug when clearing a weak value during sweep, when we wouldn't pick up the correct next pointer for a weak value that didn't have the mark bit set Change-Id: I960e58ecbb40b0ecf2bc07fe661a1ec706fcca61 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Small cleanupLars Knoll2013-05-261-4/+2
| | | | | | | | | We don't do rewriting for bindings anymore. Remove a method overload that's not really needed anymore. Change-Id: I9d57d30dce4848cb06c88c3f042ccf30e6d41aab Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Implement JS ownership policy for var and variant propertiesSimon Hausmann2013-05-241-48/+28
| | | | | | | | | | | | Instead of a GC callback, let's keep the lifecycle of the var properties and the QObject wrapped variants in sync with the lifecycle of the JS QObject wrapper, through a markObjects re-implementation. handleReferenceManagement test passes now, fixed a few incorrect gc() calls in there. Change-Id: I78e8ca700e41bba788b61d3816a77cfb3a7c5e58 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of some v8 based codeLars Knoll2013-05-241-21/+21
| | | | | Change-Id: Iee910dcc1d3148922d2f92055eb06cdb0b889502 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Replace QV8QObjectResource with QV4::QObjectWrapperSimon Hausmann2013-05-231-2/+2
| | | | | | | | | | | | | | | Use a proper sub-class instead of external object resources, as a first step towards porting the QObject bindings away from V8. This also replaces the function template / constructor approach and the faster getter optimization with a plain virtual get in the V4::Object. Property lookup in QObject bindings will be subject to future optimizations that will work very differently once we enable the faster V4 lookup mechanism in QML. Change-Id: Ib7c2eead5323c22290c2924de786d9cfcf308c03 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix crashes when invoking QML JS methods from C++Simon Hausmann2013-05-211-1/+1
| | | | | | | | Make sure to size the QVarLengthArray properly to avoid out-of-bounds access. Change-Id: Id075730ffa2e366a729b401b8563ad7fd59597de Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove half the v8::TryCatch statementsLars Knoll2013-05-211-17/+14
| | | | | | | Replacing the other half requires a replacement for v8::Script. Change-Id: I40fe99302fba23f286773ec1adaf8d3751db901d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* convert QV8VariantWrapper to v4Lars Knoll2013-05-171-21/+9
| | | | | | | | | Implement variant support through a QV4::VariantObject class. Port scarce resource support for the pixmap and image variants. Change-Id: Ib6aac8debc7f57224ccddb912ab4342c5f1dec15 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Remove the remaining traces of v8::persistentLars Knoll2013-05-081-2/+3
| | | | | Change-Id: Id542914c64558c1eba30a300cb10606fa499e594 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Move qqmlvmemetaobject over to use QV4::PersistentValueLars Knoll2013-05-081-17/+20
| | | | | Change-Id: Ifdf57d6cb266a7b63fec9f1f85bda8070c44036f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Make the default constructor of PersistentValue not allocate a d pointerLars Knoll2013-05-071-1/+1
| | | | | | | | This is also required to change the v8::Persistent in QQmlData over to v4. Change-Id: Ib3164ded9c772e977f6b43ef6163a3aa74da3800 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename Value::deletedValue() to Value::emptyValue()Lars Knoll2013-05-071-1/+1
| | | | | | | This reflects a bit better how this special value is being used. Change-Id: I136c8ab648bf82102fb2627e17c574a980c4d5ff Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>