De-duplicate vtables, part I: exported private 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. In this first batch, we de-inline destructors of exported private classes. Since they are already exported, users of these classes are unaffected by the change, and since it's private API, we don't need to avoid adding code to the out-of-line destructor until Qt 6. Change-Id: I450707877d2cb6a77f79ae1dd355facb98d6c517 Reported-by: Volker Krause <volker.krause@kdab.com> Task-number: QTBUG-45582 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
b295afb064
commit
133e402831
@ -479,6 +479,11 @@ public:
|
|||||||
|
|
||||||
Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel)
|
Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel)
|
||||||
|
|
||||||
|
|
||||||
|
QAbstractItemModelPrivate::~QAbstractItemModelPrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QAbstractItemModel *QAbstractItemModelPrivate::staticEmptyModel()
|
QAbstractItemModel *QAbstractItemModelPrivate::staticEmptyModel()
|
||||||
{
|
{
|
||||||
return qEmptyModel();
|
return qEmptyModel();
|
||||||
|
@ -71,6 +71,8 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {}
|
QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {}
|
||||||
|
~QAbstractItemModelPrivate();
|
||||||
|
|
||||||
void removePersistentIndexData(QPersistentModelIndexData *data);
|
void removePersistentIndexData(QPersistentModelIndexData *data);
|
||||||
void movePersistentIndexes(const QVector<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation);
|
void movePersistentIndexes(const QVector<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation);
|
||||||
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
|
void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
|
||||||
|
@ -65,6 +65,16 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
static int DIRECT_CONNECTION_ONLY = 0;
|
static int DIRECT_CONNECTION_ONLY = 0;
|
||||||
|
|
||||||
|
|
||||||
|
QDynamicMetaObjectData::~QDynamicMetaObjectData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QAbstractDynamicMetaObject::~QAbstractDynamicMetaObject()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct QSlotObjectBaseDeleter { // for use with QScopedPointer<QSlotObjectBase,...>
|
struct QSlotObjectBaseDeleter { // for use with QScopedPointer<QSlotObjectBase,...>
|
||||||
static void cleanup(QtPrivate::QSlotObjectBase *slot) {
|
static void cleanup(QtPrivate::QSlotObjectBase *slot) {
|
||||||
if (slot) slot->destroyIfLastRef();
|
if (slot) slot->destroyIfLastRef();
|
||||||
|
@ -406,7 +406,7 @@ void Q_CORE_EXPORT qDeleteInEventHandler(QObject *o);
|
|||||||
struct QAbstractDynamicMetaObject;
|
struct QAbstractDynamicMetaObject;
|
||||||
struct Q_CORE_EXPORT QDynamicMetaObjectData
|
struct Q_CORE_EXPORT QDynamicMetaObjectData
|
||||||
{
|
{
|
||||||
virtual ~QDynamicMetaObjectData() {}
|
virtual ~QDynamicMetaObjectData();
|
||||||
virtual void objectDestroyed(QObject *) { delete this; }
|
virtual void objectDestroyed(QObject *) { delete this; }
|
||||||
|
|
||||||
virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) = 0;
|
virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) = 0;
|
||||||
@ -415,6 +415,8 @@ struct Q_CORE_EXPORT QDynamicMetaObjectData
|
|||||||
|
|
||||||
struct Q_CORE_EXPORT QAbstractDynamicMetaObject : public QDynamicMetaObjectData, public QMetaObject
|
struct Q_CORE_EXPORT QAbstractDynamicMetaObject : public QDynamicMetaObjectData, public QMetaObject
|
||||||
{
|
{
|
||||||
|
~QAbstractDynamicMetaObject();
|
||||||
|
|
||||||
virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) Q_DECL_OVERRIDE { return this; }
|
virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) Q_DECL_OVERRIDE { return this; }
|
||||||
virtual int createProperty(const char *, const char *) { return -1; }
|
virtual int createProperty(const char *, const char *) { return -1; }
|
||||||
virtual int metaCall(QObject *, QMetaObject::Call c, int _id, void **a) Q_DECL_OVERRIDE
|
virtual int metaCall(QObject *, QMetaObject::Call c, int _id, void **a) Q_DECL_OVERRIDE
|
||||||
|
@ -102,6 +102,10 @@ QEventTransitionPrivate::QEventTransitionPrivate()
|
|||||||
registered = false;
|
registered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QEventTransitionPrivate::~QEventTransitionPrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QEventTransitionPrivate *QEventTransitionPrivate::get(QEventTransition *q)
|
QEventTransitionPrivate *QEventTransitionPrivate::get(QEventTransition *q)
|
||||||
{
|
{
|
||||||
return q->d_func();
|
return q->d_func();
|
||||||
|
@ -55,6 +55,7 @@ class Q_CORE_EXPORT QEventTransitionPrivate : public QAbstractTransitionPrivate
|
|||||||
Q_DECLARE_PUBLIC(QEventTransition)
|
Q_DECLARE_PUBLIC(QEventTransition)
|
||||||
public:
|
public:
|
||||||
QEventTransitionPrivate();
|
QEventTransitionPrivate();
|
||||||
|
~QEventTransitionPrivate();
|
||||||
|
|
||||||
static QEventTransitionPrivate *get(QEventTransition *q);
|
static QEventTransitionPrivate *get(QEventTransition *q);
|
||||||
|
|
||||||
|
@ -169,6 +169,10 @@ QOpenGLPaintDevicePrivate::QOpenGLPaintDevicePrivate(const QSize &sz)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QOpenGLPaintDevicePrivate::~QOpenGLPaintDevicePrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class QOpenGLEngineThreadStorage
|
class QOpenGLEngineThreadStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -56,7 +56,7 @@ class Q_GUI_EXPORT QOpenGLPaintDevicePrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QOpenGLPaintDevicePrivate(const QSize &size);
|
QOpenGLPaintDevicePrivate(const QSize &size);
|
||||||
virtual ~QOpenGLPaintDevicePrivate() { }
|
virtual ~QOpenGLPaintDevicePrivate();
|
||||||
|
|
||||||
static QOpenGLPaintDevicePrivate *get(QOpenGLPaintDevice *dev) { return dev->d_func(); }
|
static QOpenGLPaintDevicePrivate *get(QOpenGLPaintDevice *dev) { return dev->d_func(); }
|
||||||
|
|
||||||
|
@ -36,6 +36,10 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QPagedPaintDevicePrivate::~QPagedPaintDevicePrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QPagedPaintDevice
|
\class QPagedPaintDevice
|
||||||
\inmodule QtGui
|
\inmodule QtGui
|
||||||
|
@ -61,9 +61,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~QPagedPaintDevicePrivate()
|
virtual ~QPagedPaintDevicePrivate();
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// ### Qt6 Remove these and make public class methods virtual
|
// ### Qt6 Remove these and make public class methods virtual
|
||||||
virtual bool setPageLayout(const QPageLayout &newPageLayout)
|
virtual bool setPageLayout(const QPageLayout &newPageLayout)
|
||||||
|
@ -968,6 +968,10 @@ QRect QPaintEngine::systemRect() const
|
|||||||
return d_func()->systemRect;
|
return d_func()->systemRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPaintEnginePrivate::~QPaintEnginePrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void QPaintEnginePrivate::drawBoxTextItem(const QPointF &p, const QTextItemInt &ti)
|
void QPaintEnginePrivate::drawBoxTextItem(const QPointF &p, const QTextItemInt &ti)
|
||||||
{
|
{
|
||||||
if (!ti.glyphs.numGlyphs)
|
if (!ti.glyphs.numGlyphs)
|
||||||
|
@ -60,7 +60,8 @@ class Q_GUI_EXPORT QPaintEnginePrivate
|
|||||||
public:
|
public:
|
||||||
QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipDevice(0), hasSystemTransform(0),
|
QPaintEnginePrivate() : pdev(0), q_ptr(0), currentClipDevice(0), hasSystemTransform(0),
|
||||||
hasSystemViewport(0) {}
|
hasSystemViewport(0) {}
|
||||||
virtual ~QPaintEnginePrivate() { }
|
virtual ~QPaintEnginePrivate();
|
||||||
|
|
||||||
QPaintDevice *pdev;
|
QPaintDevice *pdev;
|
||||||
QPaintEngine *q_ptr;
|
QPaintEngine *q_ptr;
|
||||||
QRegion systemClip;
|
QRegion systemClip;
|
||||||
|
@ -111,6 +111,10 @@
|
|||||||
#ifndef QT_NO_GRAPHICSEFFECT
|
#ifndef QT_NO_GRAPHICSEFFECT
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QGraphicsEffectPrivate::~QGraphicsEffectPrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
\class QGraphicsEffectSource
|
\class QGraphicsEffectSource
|
||||||
|
@ -142,6 +142,7 @@ class Q_WIDGETS_EXPORT QGraphicsEffectPrivate : public QObjectPrivate
|
|||||||
Q_DECLARE_PUBLIC(QGraphicsEffect)
|
Q_DECLARE_PUBLIC(QGraphicsEffect)
|
||||||
public:
|
public:
|
||||||
QGraphicsEffectPrivate() : source(0), isEnabled(1) {}
|
QGraphicsEffectPrivate() : source(0), isEnabled(1) {}
|
||||||
|
~QGraphicsEffectPrivate();
|
||||||
|
|
||||||
inline void setGraphicsEffectSource(QGraphicsEffectSource *newSource)
|
inline void setGraphicsEffectSource(QGraphicsEffectSource *newSource)
|
||||||
{
|
{
|
||||||
|
@ -362,6 +362,10 @@ QGraphicsViewPrivate::QGraphicsViewPrivate()
|
|||||||
styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS);
|
styleOptions.reserve(QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGraphicsViewPrivate::~QGraphicsViewPrivate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
|
@ -63,6 +63,7 @@ class Q_WIDGETS_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
|
|||||||
Q_DECLARE_PUBLIC(QGraphicsView)
|
Q_DECLARE_PUBLIC(QGraphicsView)
|
||||||
public:
|
public:
|
||||||
QGraphicsViewPrivate();
|
QGraphicsViewPrivate();
|
||||||
|
~QGraphicsViewPrivate();
|
||||||
|
|
||||||
void recalculateContentSize();
|
void recalculateContentSize();
|
||||||
void centerView(QGraphicsView::ViewportAnchor anchor);
|
void centerView(QGraphicsView::ViewportAnchor anchor);
|
||||||
|
Loading…
Reference in New Issue
Block a user