qt5base-lts/tests/auto/tools/moc
Thiago Macieira 9b8493314d Qt6: Fix uninitialized meta objects on Windows
Windows has a problem relating to cross-DLL variable relocations: they
are not supported. Since QMetaObject's link to the parent class is done
via a pointer, every QMetaObject in a DLL or in the EXE that derives
from a class from another DLL (such as QObject) will be dynamically
initialized.

This commit changes the meta object pointers in QMetaObject::d from raw
pointers to a wrapper class SuperData, which is almost entirely source-
compatible with the pointer itself. On all systems except for Windows
with Qt 6, it's binary compatible with the current implementation.

But for Windows with Qt 6, this commit will store both the raw pointer
and a pointer to a function that returns the QMetaObject, with one of
them non-null only. For all meta objects constructed by moc, we store
the function pointer, which allows the staticMetaObject to be statically
intialized. For dynamic meta objects (QMetaObjectBuilder, QtDBus, QtQml,
ActiveQt), we'll store the actual raw pointer.

[ChangeLog][QtCore][QMetaObject] Some internal members of the
QMetaObject class have changed types. Those members are not public API
and thus should not cause source incompatibilities.

The macro QT_NO_DATA_RELOCATION existed in Qt 4 but was called
Q_NO_DATA_RELOCATION and only applied to Symbian. It was removed in
commit 24a72c4efa ("qglobal: Remove
symbian specific features").

Task-number: QTBUG-38876
Fixes: QTBUG-69963
Change-Id: Id92f4a61915b49ddaee6fffd14ae1cf615525e92
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2019-07-16 18:34:41 -07:00
..
subdir moc: get the system #defines from the compiler itself 2016-07-20 02:54:03 +00:00
task71021 Moved autotests in category 'tools' into new directory structure 2011-09-12 10:08:29 +02:00
Test.framework/Headers Updated license headers 2016-01-21 18:55:18 +00:00
testproject Updated license headers 2016-01-21 18:55:18 +00:00
.gitattributes Moved autotests in category 'tools' into new directory structure 2011-09-12 10:08:29 +02:00
.gitignore Moved autotests in category 'tools' into new directory structure 2011-09-12 10:08:29 +02:00
assign-namespace.h Updated license headers 2016-01-21 18:55:18 +00:00
backslash-newlines.h Merge remote-tracking branch 'origin/5.6' into 5.7 2016-05-19 12:55:27 +02:00
c-comments.h Updated license headers 2016-01-21 18:55:18 +00:00
cstyle-enums.h Updated license headers 2016-01-21 18:55:18 +00:00
cxx11-enums.h Remove handling of missing Q_COMPILER_CLASS_ENUM 2019-04-06 16:19:14 +00:00
cxx11-explicit-override-control.h Replace Q_DECL_OVERRIDE with override where possible 2017-09-19 11:53:42 +00:00
cxx11-final-classes.h Updated license headers 2016-01-21 18:55:18 +00:00
cxx17-namespaces.h tst_moc: fix include guards 2017-03-25 12:53:09 +00:00
cxx-attributes.h moc: Fix parsing of [[deprecated]] enum values 2019-03-11 14:11:33 +00:00
dir-in-include-path.h Updated license headers 2016-01-21 18:55:18 +00:00
dollars.h Updated license headers 2016-01-21 18:55:18 +00:00
error-on-wrong-notify.h moc: Allow NOTIFY signals defined in parent classes 2017-05-23 11:11:52 +00:00
escapes-in-string-literals.h Updated license headers 2016-01-21 18:55:18 +00:00
extraqualification.h Updated license headers 2016-01-21 18:55:18 +00:00
forgotten-qinterface.h Updated license headers 2016-01-21 18:55:18 +00:00
forward-declared-param.h Update the Intel copyright year 2016-01-21 22:44:16 +00:00
function-with-attributes.h Updated license headers 2016-01-21 18:55:18 +00:00
gadgetwithnoenums.h Updated license headers 2016-01-21 18:55:18 +00:00
grand-parent-gadget-class.h Updated license headers 2016-01-21 18:55:18 +00:00
Header Moved autotests in category 'tools' into new directory structure 2011-09-12 10:08:29 +02:00
interface-from-framework.h Updated license headers 2016-01-21 18:55:18 +00:00
interface-from-include.h Updated license headers 2016-01-21 18:55:18 +00:00
macro-on-cmdline.h Updated license headers 2016-01-21 18:55:18 +00:00
moc.pro Add support for C++ functions attributes in moc 2019-03-07 06:53:21 +00:00
namespace_no_merge.h moc: support nested q_namespaces 2016-09-28 16:44:19 +00:00
namespace.h moc: Don't error our when parsing "using namespace __identifier(...)" 2018-03-05 06:54:06 +00:00
namespaced-flags.h Updated license headers 2016-01-21 18:55:18 +00:00
no-keywords.h Clean up the moc "no-keywords" test 2018-03-21 10:31:20 +00:00
non-gadget-parent-class.h Updated license headers 2016-01-21 18:55:18 +00:00
oldstyle-casts.h Updated license headers 2016-01-21 18:55:18 +00:00
os9-newlines.h Updated license headers 2016-01-21 18:55:18 +00:00
parse-boost.h Updated license headers 2016-01-21 18:55:18 +00:00
parse-defines.h Remove handling of missing very old compiler feature check 2019-04-06 13:27:15 +00:00
plugin_metadata.h Updated license headers 2016-01-21 18:55:18 +00:00
pp-dollar-signs.h Updated license headers 2016-01-21 18:55:18 +00:00
pure-virtual-signals.h Updated license headers 2016-01-21 18:55:18 +00:00
qinvokable.h Updated license headers 2016-01-21 18:55:18 +00:00
qprivateslots.h Updated license headers 2016-01-21 18:55:18 +00:00
qtbug-35657-gadget.h Updated license headers 2016-01-21 18:55:18 +00:00
related-metaobjects-in-gadget.h Updated license headers 2016-01-21 18:55:18 +00:00
related-metaobjects-in-namespaces.h Updated license headers 2016-01-21 18:55:18 +00:00
related-metaobjects-name-conflict.h Updated license headers 2016-01-21 18:55:18 +00:00
single_function_keyword.h Updated license headers 2016-01-21 18:55:18 +00:00
single-quote-digit-separator-n3781.h Updated license headers 2016-01-21 18:55:18 +00:00
slots-with-void-template.h Updated license headers 2016-01-21 18:55:18 +00:00
task87883.h Updated license headers 2016-01-21 18:55:18 +00:00
task189996.h Updated license headers 2016-01-21 18:55:18 +00:00
task192552.h Updated license headers 2016-01-21 18:55:18 +00:00
task234909.h Updated license headers 2016-01-21 18:55:18 +00:00
task240368.h Updated license headers 2016-01-21 18:55:18 +00:00
template-gtgt.h Updated license headers 2016-01-21 18:55:18 +00:00
trigraphs.h Updated license headers 2016-01-21 18:55:18 +00:00
tst_moc.cpp Qt6: Fix uninitialized meta objects on Windows 2019-07-16 18:34:41 -07:00
unterminated-function-macro.h Updated license headers 2016-01-21 18:55:18 +00:00
using-namespaces.h Updated license headers 2016-01-21 18:55:18 +00:00
warn-on-multiple-qobject-subclasses.h Updated license headers 2016-01-21 18:55:18 +00:00
warn-on-property-without-read.h Updated license headers 2016-01-21 18:55:18 +00:00
win-newlines.h Updated license headers 2016-01-21 18:55:18 +00:00