From 8d9d609e637765572d949f01bae47dcc01f2c110 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 1 Jun 2015 00:22:35 +0200 Subject: De-duplicate vtables, part II: exported public 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 second and last batch, we de-inline destructors of exported public classes. Since they are already exported, users of these classes are unaffected by the change, but since it's public API, and the dtors may have been de-virtualized and inlined into application code, we need to avoid adding code to the out-of-line destructor until Qt 6. Change-Id: Ieda9553cb4b0dae7217c37cc7cde321dd7302122 Reported-by: Volker Krause Task-number: QTBUG-45582 Reviewed-by: Friedemann Kleint Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll Reviewed-by: Thiago Macieira --- src/gui/kernel/qevent.cpp | 5 +++++ src/gui/kernel/qevent.h | 2 ++ src/gui/text/qabstracttextdocumentlayout.cpp | 5 +++++ src/gui/text/qabstracttextdocumentlayout.h | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 006f4d6245..1dc3e69470 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -1971,6 +1971,11 @@ QInputMethodEvent::QInputMethodEvent(const QInputMethodEvent &other) { } +QInputMethodEvent::~QInputMethodEvent() +{ + // must be empty until ### Qt 6 +} + /*! Sets the commit string to \a commitString. diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 0cf0601db9..61316b0af5 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -531,6 +531,8 @@ public: }; QInputMethodEvent(); QInputMethodEvent(const QString &preeditText, const QList &attributes); + ~QInputMethodEvent(); + void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); inline const QList &attributes() const { return attrs; } inline const QString &preeditString() const { return preedit; } diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index 8d2da46ab3..7735fd6b46 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -44,6 +44,11 @@ QAbstractTextDocumentLayoutPrivate::~QAbstractTextDocumentLayoutPrivate() { } +QTextObjectInterface::~QTextObjectInterface() +{ + // must be empty until ### Qt 6 +} + /*! \class QAbstractTextDocumentLayout \reentrant diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 27135b0476..68e7a0e4e9 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -126,7 +126,7 @@ private: class Q_GUI_EXPORT QTextObjectInterface { public: - virtual ~QTextObjectInterface() {} + virtual ~QTextObjectInterface(); virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; }; -- cgit v1.2.3