summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-11-14 14:15:04 +0400
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2014-11-15 14:45:43 +0100
commit0600f7d6299a21014f1b72d54fc6b23c02693204 (patch)
tree78d0a84735e0c3030402bb8519f6ee3dd32a3c71 /src
parentf44eb5c57f28825e29425be339a00df5d99b68eb (diff)
Fix hb_face leaking in QFontEngineFT
Since HarfBuzz-old's HB_Face doesn't support ref-counting, it is impossible to keep the same behavior as for NG's ref-counted hb_face when we're going to reparent the data of unknown type in QFontEngineFT. We should either not release the object returned by harfbuzzFace(), or introduce ref-counting for HB-old's HB_Face. Stop referencing HB-NG's objects on access for now and thus avoid a need to release them manually. Task-number: QTBUG-42674 Change-Id: Ia21e7ba9c17185796b0dd98c2c27d02566f2a701 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qharfbuzzng.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp2
3 files changed, 2 insertions, 8 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 52e10bd717..0b517fbf29 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -373,8 +373,6 @@ bool QFontEngine::supportsScript(QChar::Script script) const
if (!ret && script_tag_2 != HB_OT_TAG_DEFAULT_SCRIPT)
ret = hb_ot_layout_table_find_script(face, HB_OT_TAG_GSUB, HB_OT_TAG_DEFAULT_SCRIPT, &script_index);
}
-
- hb_face_destroy(face);
}
return ret;
}
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index eb7bca1974..16c45e642b 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -632,7 +632,7 @@ hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe)
fe->face_destroy_func = _hb_qt_face_release;
}
- return hb_face_reference((hb_face_t *)fe->face_);
+ return (hb_face_t *)fe->face_;
}
@@ -645,8 +645,6 @@ _hb_qt_font_create(QFontEngine *fe)
hb_font_t *font = hb_font_create(face);
- hb_face_destroy(face); // ref-ed in hb_qt_face_get_for_engine()
-
if (Q_UNLIKELY(hb_font_is_immutable(font))) {
hb_font_destroy(font);
return NULL;
@@ -684,7 +682,7 @@ hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe)
fe->font_destroy_func = _hb_qt_font_release;
}
- return hb_font_reference((hb_font_t *)fe->font_);
+ return (hb_font_t *)fe->font_;
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 9fe1fd26e9..d156124b98 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1168,8 +1168,6 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
};
const int num_features = 1;
shapedOk = hb_shape_full(hb_font, buffer, features, num_features, 0);
-
- hb_font_destroy(hb_font);
}
if (!shapedOk) {
hb_buffer_destroy(buffer);