diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-05-14 08:52:45 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-19 07:03:19 +0000 |
commit | 6f6207fadc1a334d1aed98f840a0d074acf18d06 (patch) | |
tree | 083bf49b4d6bc999f099b3c1e2897cb23cb89887 /src/render/lights | |
parent | 72f2c87d15c76cc861699aea536e01bc8d56c8f2 (diff) |
De-inline dtors of public polymorphic classes
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.
It also allows to add code to them later, if necessary.
Change-Id: I0da301cd788162abba6cdbbb21910090a22adb9a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/lights')
-rw-r--r-- | src/render/lights/qabstractlight.cpp | 4 | ||||
-rw-r--r-- | src/render/lights/qabstractlight.h | 4 | ||||
-rw-r--r-- | src/render/lights/qdirectionallight.cpp | 5 | ||||
-rw-r--r-- | src/render/lights/qdirectionallight.h | 1 | ||||
-rw-r--r-- | src/render/lights/qpointlight.cpp | 5 | ||||
-rw-r--r-- | src/render/lights/qpointlight.h | 1 | ||||
-rw-r--r-- | src/render/lights/qspotlight.cpp | 5 | ||||
-rw-r--r-- | src/render/lights/qspotlight.h | 1 |
8 files changed, 25 insertions, 1 deletions
diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qabstractlight.cpp index 767ce9031..e3d0d86bf 100644 --- a/src/render/lights/qabstractlight.cpp +++ b/src/render/lights/qabstractlight.cpp @@ -83,6 +83,10 @@ QAbstractLight::QAbstractLight(QAbstractLightPrivate &dd, QNode *parent) d->m_shaderData->setParent(this); } +QAbstractLight::~QAbstractLight() +{ +} + QAbstractLight::Type QAbstractLight::type() const { Q_D(const QAbstractLight); diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qabstractlight.h index 8ac9bc05f..7cc98b57b 100644 --- a/src/render/lights/qabstractlight.h +++ b/src/render/lights/qabstractlight.h @@ -59,7 +59,9 @@ class QT3DRENDERSHARED_EXPORT QAbstractLight : public Qt3DCore::QComponent Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) Q_PROPERTY(float intensity READ intensity WRITE setIntensity NOTIFY intensityChanged) -public : +public: + ~QAbstractLight(); + enum Type { PointLight = 0, DirectionalLight, diff --git a/src/render/lights/qdirectionallight.cpp b/src/render/lights/qdirectionallight.cpp index ca16ba878..57b5c85cd 100644 --- a/src/render/lights/qdirectionallight.cpp +++ b/src/render/lights/qdirectionallight.cpp @@ -76,6 +76,11 @@ QDirectionalLight::QDirectionalLight(QNode *parent) } /*! \internal */ +QDirectionalLight::~QDirectionalLight() +{ +} + +/*! \internal */ QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, QNode *parent) : QAbstractLight(dd, parent) { diff --git a/src/render/lights/qdirectionallight.h b/src/render/lights/qdirectionallight.h index 46d5db927..6be1585db 100644 --- a/src/render/lights/qdirectionallight.h +++ b/src/render/lights/qdirectionallight.h @@ -55,6 +55,7 @@ class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QAbstractLight public: explicit QDirectionalLight(Qt3DCore::QNode *parent = nullptr); + ~QDirectionalLight(); QVector3D worldDirection() const; diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp index b62980d34..1936ef4f4 100644 --- a/src/render/lights/qpointlight.cpp +++ b/src/render/lights/qpointlight.cpp @@ -95,6 +95,11 @@ QPointLight::QPointLight(QNode *parent) } /*! \internal */ +QPointLight::~QPointLight() +{ +} + +/*! \internal */ QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent) : QAbstractLight(dd, parent) { diff --git a/src/render/lights/qpointlight.h b/src/render/lights/qpointlight.h index c5b9b2d51..16e048560 100644 --- a/src/render/lights/qpointlight.h +++ b/src/render/lights/qpointlight.h @@ -57,6 +57,7 @@ class QT3DRENDERSHARED_EXPORT QPointLight : public QAbstractLight public: explicit QPointLight(Qt3DCore::QNode *parent = nullptr); + ~QPointLight(); float constantAttenuation() const; float linearAttenuation() const; diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp index 82dc793c5..aa2c8c201 100644 --- a/src/render/lights/qspotlight.cpp +++ b/src/render/lights/qspotlight.cpp @@ -101,6 +101,11 @@ QSpotLight::QSpotLight(QNode *parent) } /*! \internal */ +QSpotLight::~QSpotLight() +{ +} + +/*! \internal */ QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent) : QAbstractLight(dd, parent) { diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h index 846f8907e..8497740db 100644 --- a/src/render/lights/qspotlight.h +++ b/src/render/lights/qspotlight.h @@ -59,6 +59,7 @@ class QT3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight public: explicit QSpotLight(Qt3DCore::QNode *parent = nullptr); + ~QSpotLight(); QVector3D attenuation() const; QVector3D localDirection() const; |