summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-04-14 09:37:58 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-05-26 17:51:47 +0000
commit16b95b65a6fea501dade6e3f5f1ad48f7dfaa173 (patch)
tree9e9d8858160bc5a1e066492fff0364ff0b4f778f /src/gui/painting
parent10d53a3f0e09ec2ef437619bb1bb0dbb40f7ee8b (diff)
Q*GlyphCache: de-inline dtor and export vtable
The destructor is the first virtual method. By not defining it out-of-line, we provoke multiple copies of vtables, not all of which can be merged by the linker. If the linker fails, RTTI such as dynamic_cast and catch-blocks involving the type will not work. Additionally, QFontEngineGlyphCache was not exported, and therefore also not its vtable, making it impossible for users outside of QtGui to get a unique RTTI for the class. Change-Id: Ib265945934216bb609629431eb4c71996d4fd39d Reported-by: Volker Krause <volker.krause@kdab.com> Task-number: QTBUG-45582 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp10
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h4
2 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 4c879cf05d..056fd8b701 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -42,6 +42,11 @@ QT_BEGIN_NAMESPACE
// #define CACHE_DEBUG
+// out-of-line to avoid vtable duplication, breaking e.g. RTTI
+QTextureGlyphCache::~QTextureGlyphCache()
+{
+}
+
int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const
{
// Test 12 different subpixel positions since it factors into 3*4 so it gives
@@ -262,6 +267,11 @@ QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition
* QImageTextureGlyphCache
*/
+// out-of-line to avoid vtable duplication, breaking e.g. RTTI
+QImageTextureGlyphCache::~QImageTextureGlyphCache()
+{
+}
+
void QImageTextureGlyphCache::resizeTextureData(int width, int height)
{
m_image = m_image.copy(0, 0, width, height);
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index c9e7060b0d..7dd8277a45 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -72,7 +72,7 @@ public:
m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0)
{ }
- virtual ~QTextureGlyphCache() { }
+ ~QTextureGlyphCache();
struct GlyphAndSubPixelPosition
{
@@ -158,6 +158,8 @@ class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache
public:
QImageTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
: QTextureGlyphCache(format, matrix) { }
+ ~QImageTextureGlyphCache();
+
virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE;
virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE;
virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE;