do not inherit QObject from QFontEngine

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-20 22:03:24 +03:00
parent 04df82a5b2
commit f6bec01cb2
3 changed files with 8 additions and 17 deletions

View file

@ -1329,11 +1329,13 @@ void QFontCache::clear()
EngineCache::ConstIterator it = engineCache.constBegin(), EngineCache::ConstIterator it = engineCache.constBegin(),
end = engineCache.constEnd(); end = engineCache.constEnd();
while (it != end) { while (it != end) {
if (!it.value()->ref.deref()) QFontEngine* engine = it.value();
delete it.value(); if (!engine->ref.deref()) {
else delete engine;
} else {
FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d", FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d",
it.value(), int(it.value()->ref)); engine, int(engine->ref));
}
++it; ++it;
} }

View file

@ -36,16 +36,11 @@ QT_BEGIN_NAMESPACE
// QFontEngine // QFontEngine
QFontEngine::QFontEngine() QFontEngine::QFontEngine()
: QObject(), : ref(1)
ref(1)
{ {
fsType = 0; fsType = 0;
} }
QFontEngine::~QFontEngine()
{
}
QFixed QFontEngine::lineThickness() const QFixed QFontEngine::lineThickness() const
{ {
// ad hoc algorithm // ad hoc algorithm
@ -304,10 +299,6 @@ QFontEngineBox::QFontEngineBox(int size)
{ {
} }
QFontEngineBox::~QFontEngineBox()
{
}
bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags) const bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags) const
{ {
if (*nglyphs < len) { if (*nglyphs < len) {

View file

@ -57,7 +57,7 @@ struct QGlyphLayout;
) )
class Q_GUI_EXPORT QFontEngine : public QObject class Q_GUI_EXPORT QFontEngine
{ {
public: public:
enum Type { enum Type {
@ -66,7 +66,6 @@ public:
}; };
QFontEngine(); QFontEngine();
virtual ~QFontEngine();
// all of these are in unscaled metrics if the engine supports uncsaled metrics, // all of these are in unscaled metrics if the engine supports uncsaled metrics,
// otherwise in design metrics // otherwise in design metrics
@ -175,7 +174,6 @@ class QFontEngineBox : public QFontEngine
{ {
public: public:
QFontEngineBox(int size); QFontEngineBox(int size);
~QFontEngineBox();
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const;
virtual void recalcAdvances(QGlyphLayout *) const; virtual void recalcAdvances(QGlyphLayout *) const;