diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-10-22 08:30:32 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-06 12:40:55 +0100 |
commit | 9d95bc58e82c65527a364906eca740151fe3301b (patch) | |
tree | 78b85f2c8fc2863bb973a8ed091e5b9a45cc84a2 /src/widgets/kernel | |
parent | 65755f9a68947e774c640ce92c022d677acdcc4a (diff) |
De-inline some destructors in QtWidgets
Destructors should be out-of-line so that the compiler doesn't generate
one per translation unit.
Apart from creating more work for the compiler, it can also lead to
duplicated vtables if the dtor is the first virtual function
(reimplementation), and all other virtuals are inline, too.
Duplicate vtables then break RTTI.
In addition, having virtual dtors de-inlined allows us to add code
to them in a BC way.
As a final argument, this change may lead to less code app-side, since
a sequence of cross-DLL calls (to member variable dtors) is replaced
by a single cross-DLL call to the new out-of-line dtor.
Change-Id: Ifb8c4aa992c75d61ba9ac8de5ab41d1e96b0a0b1
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qgesture.cpp | 34 | ||||
-rw-r--r-- | src/widgets/kernel/qgesture.h | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qlayoutitem.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qlayoutitem.h | 4 |
4 files changed, 53 insertions, 0 deletions
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp index 28e3213c83..1f12d1a60d 100644 --- a/src/widgets/kernel/qgesture.cpp +++ b/src/widgets/kernel/qgesture.cpp @@ -295,6 +295,12 @@ QPanGesture::QPanGesture(QObject *parent) d_func()->gestureType = Qt::PanGesture; } +/*! + Destructor. +*/ +QPanGesture::~QPanGesture() +{ +} QPointF QPanGesture::lastOffset() const { @@ -486,6 +492,13 @@ QPinchGesture::QPinchGesture(QObject *parent) d_func()->gestureType = Qt::PinchGesture; } +/*! + Destructor. +*/ +QPinchGesture::~QPinchGesture() +{ +} + QPinchGesture::ChangeFlags QPinchGesture::totalChangeFlags() const { return d_func()->totalChangeFlags; @@ -673,6 +686,13 @@ QSwipeGesture::QSwipeGesture(QObject *parent) d_func()->gestureType = Qt::SwipeGesture; } +/*! + Destructor. +*/ +QSwipeGesture::~QSwipeGesture() +{ +} + QSwipeGesture::SwipeDirection QSwipeGesture::horizontalDirection() const { Q_D(const QSwipeGesture); @@ -732,6 +752,13 @@ QTapGesture::QTapGesture(QObject *parent) d_func()->gestureType = Qt::TapGesture; } +/*! + Destructor. +*/ +QTapGesture::~QTapGesture() +{ +} + QPointF QTapGesture::position() const { return d_func()->position; @@ -769,6 +796,13 @@ QTapAndHoldGesture::QTapAndHoldGesture(QObject *parent) d_func()->gestureType = Qt::TapAndHoldGesture; } +/*! + Destructor. +*/ +QTapAndHoldGesture::~QTapAndHoldGesture() +{ +} + QPointF QTapAndHoldGesture::position() const { return d_func()->position; diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h index b8a719383a..0f09f209c0 100644 --- a/src/widgets/kernel/qgesture.h +++ b/src/widgets/kernel/qgesture.h @@ -118,6 +118,7 @@ class Q_WIDGETS_EXPORT QPanGesture : public QGesture public: explicit QPanGesture(QObject *parent = 0); + ~QPanGesture(); QPointF lastOffset() const; QPointF offset() const; @@ -164,6 +165,7 @@ public: public: explicit QPinchGesture(QObject *parent = 0); + ~QPinchGesture(); ChangeFlags totalChangeFlags() const; void setTotalChangeFlags(ChangeFlags value); @@ -219,6 +221,7 @@ public: enum SwipeDirection { NoDirection, Left, Right, Up, Down }; explicit QSwipeGesture(QObject *parent = 0); + ~QSwipeGesture(); SwipeDirection horizontalDirection() const; SwipeDirection verticalDirection() const; @@ -239,6 +242,7 @@ class Q_WIDGETS_EXPORT QTapGesture : public QGesture public: explicit QTapGesture(QObject *parent = 0); + ~QTapGesture(); QPointF position() const; void setPosition(const QPointF &pos); @@ -256,6 +260,7 @@ class Q_WIDGETS_EXPORT QTapAndHoldGesture : public QGesture public: explicit QTapAndHoldGesture(QObject *parent = 0); + ~QTapAndHoldGesture(); QPointF position() const; void setPosition(const QPointF &pos); diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 5ef3c17454..7de3f47c5b 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -263,6 +263,11 @@ void QLayoutItem::setAlignment(Qt::Alignment alignment) */ /*! + Destructor. +*/ +QSpacerItem::~QSpacerItem() {} + +/*! Changes this spacer item to have preferred width \a w, preferred height \a h, horizontal size policy \a hPolicy and vertical size policy \a vPolicy. @@ -291,6 +296,11 @@ void QSpacerItem::changeSize(int w, int h, QSizePolicy::Policy hPolicy, */ /*! + Destructor. +*/ +QWidgetItem::~QWidgetItem() {} + +/*! Destroys the QLayoutItem. */ QLayoutItem::~QLayoutItem() diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h index a2f60b1696..093e7fe61b 100644 --- a/src/widgets/kernel/qlayoutitem.h +++ b/src/widgets/kernel/qlayoutitem.h @@ -99,6 +99,8 @@ public: QSizePolicy::Policy hData = QSizePolicy::Minimum, QSizePolicy::Policy vData = QSizePolicy::Minimum) : width(w), height(h), sizeP(hData, vData) { } + ~QSpacerItem(); + void changeSize(int w, int h, QSizePolicy::Policy hData = QSizePolicy::Minimum, QSizePolicy::Policy vData = QSizePolicy::Minimum); @@ -124,6 +126,8 @@ class Q_WIDGETS_EXPORT QWidgetItem : public QLayoutItem public: explicit QWidgetItem(QWidget *w) : wid(w) { } + ~QWidgetItem(); + QSize sizeHint() const; QSize minimumSize() const; QSize maximumSize() const; |