diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-09-08 11:07:26 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-09-30 14:14:31 +0000 |
commit | b80fa8e7d59c2824de067ab4d488d865a6e69d94 (patch) | |
tree | dfbab030756f9c5a0f76aba8a558f429311724a2 /src/qml/jsruntime/qv4managed_p.h | |
parent | c2e28350a6ea866b9e68059f232aaeccd47f743b (diff) |
QML: Make all context objects trivial
This change also adds a check to the d() calls for Managed, verifies
that the object has been initialized. This is only done for debug
builds.
To prevent other code from tripping the check, a number of other classes
are either marked as trivial, or do initialization in the constructors.
Because of template function changes in them memory manager (those now
call init() instead of in-place new), String has an extra parameter
to force it to temporarily use an old/unmodified template function.
Change-Id: I8c35161ce7680835d830638b6d21498c5129b02b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4managed_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4managed_p.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4managed_p.h b/src/qml/jsruntime/qv4managed_p.h index 1109760fc0..764a8e7f3f 100644 --- a/src/qml/jsruntime/qv4managed_p.h +++ b/src/qml/jsruntime/qv4managed_p.h @@ -85,7 +85,12 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {} static const QV4::VTable static_vtbl; \ static inline const QV4::VTable *staticVTable() { return &static_vtbl; } \ V4_MANAGED_SIZE_TEST \ - QV4::Heap::DataClass *d() const { return static_cast<QV4::Heap::DataClass *>(m()); } + QV4::Heap::DataClass *d_unchecked() const { return static_cast<QV4::Heap::DataClass *>(m()); } \ + QV4::Heap::DataClass *d() const { \ + QV4::Heap::DataClass *dptr = d_unchecked(); \ + if (std::is_trivial<QV4::Heap::DataClass>::value) dptr->_checkIsInitialized(); \ + return dptr; \ + } #define V4_MANAGED(DataClass, superClass) \ private: \ |