diff --git a/src/rendering/utils/shaper/TextShaperHarfbuzz.cpp b/src/rendering/utils/shaper/TextShaperHarfbuzz.cpp index f65fc8fcb7..92a600713c 100644 --- a/src/rendering/utils/shaper/TextShaperHarfbuzz.cpp +++ b/src/rendering/utils/shaper/TextShaperHarfbuzz.cpp @@ -156,6 +156,19 @@ static std::shared_ptr CreateHBFont(const std::shared_ptr autoLock(_mutex); + return hb_buffer_create(); +} + +static void HarfbuzzBufferDestroy(hb_buffer_t* buffer) { + std::lock_guard autoLock(_mutex); + hb_buffer_destroy(buffer); +} + static std::vector> Shape( const std::string& text, const std::shared_ptr& typeface) { auto hbFont = CreateHBFont(typeface); @@ -163,7 +176,7 @@ static std::vector> Shape( return {}; } - auto hbBuffer = std::shared_ptr(hb_buffer_create(), hb_buffer_destroy); + auto hbBuffer = std::shared_ptr(HarfbuzzBufferCreate(), HarfbuzzBufferDestroy); if (!hb_buffer_allocation_successful(hbBuffer.get())) { LOGI("TextShaperHarfbuzz::shape text = %s, alloc harfbuzz(%p) failure", text.c_str(), hbBuffer.get());