From 19995f863b04b00cef908fa5aac65139971cc993 Mon Sep 17 00:00:00 2001 From: rh101 Date: Mon, 26 Apr 2021 17:31:34 +1000 Subject: [PATCH] Get the raw pointer on creation of the FileStream to avoid any accidental usage of the unique_ptr. --- cocos/2d/CCFontFreeType.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCFontFreeType.cpp b/cocos/2d/CCFontFreeType.cpp index d8d75b1602..be1b0d9e44 100644 --- a/cocos/2d/CCFontFreeType.cpp +++ b/cocos/2d/CCFontFreeType.cpp @@ -174,7 +174,7 @@ bool FontFreeType::createFontObject(const std::string &fontName, float fontSize) auto fullPath = FileUtils::getInstance()->fullPathForFilename(fontName); if (fullPath.empty()) return false; - auto fs = FileUtils::getInstance()->openFileStream(fullPath, FileStream::Mode::READ); + auto fs = FileUtils::getInstance()->openFileStream(fullPath, FileStream::Mode::READ).release(); if (!fs) { return false; @@ -187,7 +187,7 @@ bool FontFreeType::createFontObject(const std::string &fontName, float fontSize) fts->size = fs->tell(); fs->seek(0, SEEK_SET); - fts->descriptor.pointer = fs.release(); + fts->descriptor.pointer = fs; FT_Open_Args args = { 0 }; args.flags = FT_OPEN_STREAM;