Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
c335fd79
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
11 个月 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c335fd79
编写于
2月 25, 2016
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
In trampoline implementation of get_glyph(), don't destroy user data twice!
上级
23335dea
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
14 deletion
+27
-14
src/hb-font.cc
src/hb-font.cc
+27
-14
未找到文件。
src/hb-font.cc
浏览文件 @
c335fd79
...
...
@@ -1546,6 +1546,7 @@ struct hb_trampoline_closure_t
{
void
*
user_data
;
hb_destroy_func_t
destroy
;
unsigned
int
ref_count
;
};
template
<
typename
FuncType
>
...
...
@@ -1566,23 +1567,30 @@ trampoline_create (FuncType func,
trampoline_t
*
trampoline
=
(
trampoline_t
*
)
calloc
(
1
,
sizeof
(
trampoline_t
));
if
(
unlikely
(
!
trampoline
))
{
if
(
destroy
)
destroy
(
user_data
);
return
NULL
;
}
trampoline
->
closure
.
user_data
=
user_data
;
trampoline
->
closure
.
destroy
=
destroy
;
trampoline
->
closure
.
ref_count
=
1
;
trampoline
->
func
=
func
;
return
trampoline
;
}
static
void
trampoline_reference
(
hb_trampoline_closure_t
*
closure
)
{
closure
->
ref_count
++
;
}
static
void
trampoline_destroy
(
void
*
user_data
)
{
hb_trampoline_closure_t
*
closure
=
(
hb_trampoline_closure_t
*
)
user_data
;
if
(
--
closure
->
ref_count
)
return
;
if
(
closure
->
destroy
)
closure
->
destroy
(
closure
->
user_data
);
free
(
closure
);
...
...
@@ -1634,16 +1642,21 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_trampoline_t
*
trampoline
;
trampoline
=
trampoline_create
(
func
,
user_data
,
destroy
);
if
(
likely
(
trampoline
))
hb_font_funcs_set_nominal_glyph_func
(
ffuncs
,
hb_font_get_nominal_glyph_trampoline
,
if
(
unlikely
(
!
trampoline
))
{
if
(
destroy
)
destroy
(
user_data
);
return
;
}
hb_font_funcs_set_nominal_glyph_func
(
ffuncs
,
hb_font_get_nominal_glyph_trampoline
,
trampoline
,
trampoline_destroy
);
trampoline_reference
(
&
trampoline
->
closure
);
hb_font_funcs_set_variation_glyph_func
(
ffuncs
,
hb_font_get_variation_glyph_trampoline
,
trampoline
,
trampoline_destroy
);
trampoline
=
trampoline_create
(
func
,
user_data
,
destroy
);
if
(
likely
(
trampoline
))
hb_font_funcs_set_variation_glyph_func
(
ffuncs
,
hb_font_get_variation_glyph_trampoline
,
trampoline
,
trampoline_destroy
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录