diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-02 17:28:09 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2011-04-04 08:37:04 (GMT) |
commit | ae9a504def982f32111bbcc28788d7ad1cadaa10 (patch) | |
tree | 2207bfc821d381805dd6e92aead2ced473f2ba44 /src/tools/moc | |
parent | 0a330c0479a363bc5ab2e2c036fd938b52f4c92c (diff) | |
download | Qt-ae9a504def982f32111bbcc28788d7ad1cadaa10.zip Qt-ae9a504def982f32111bbcc28788d7ad1cadaa10.tar.gz Qt-ae9a504def982f32111bbcc28788d7ad1cadaa10.tar.bz2 |
moc: qobject_cast cannot be used if the class privately iherit from QObject
because the qobject_cast function do not have the right to access the
staticMetaObject.
Diffstat (limited to 'src/tools/moc')
-rw-r--r-- | src/tools/moc/generator.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 67aba8f..aea156d 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -920,7 +920,9 @@ void Generator::generateStaticMetacall() else fprintf(out, " "); fprintf(out, "if (_c == QMetaObject::InvokeMetaMethod) {\n"); - fprintf(out, " Q_ASSERT(qobject_cast<%s *>(_o));\n", cdef->classname.constData()); +#ifndef QT_NO_DEBUG + fprintf(out, " Q_ASSERT(staticMetaObject.cast(_o));\n"); +#endif fprintf(out, " %s *_t = static_cast<%s *>(_o);\n", cdef->classname.constData(), cdef->classname.constData()); fprintf(out, " switch (_id) {\n"); for (int methodindex = 0; methodindex < methodList.size(); ++methodindex) { |