• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: Commit

ソースコードの管理場所


Commit MetaInfo

Revision003ac3cf49c2424faf728c0a4b4c86d3675beca2 (tree)
Time2022-08-16 08:05:20
AuthorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Log Message

fix memory leak of luatexja.jfont.append_italic()

Change Summary

Incremental Difference

--- a/src/ltj-direction.lua
+++ b/src/ltj-direction.lua
@@ -986,7 +986,9 @@ do
986986 function luatexja.direction.vsplit()
987987 local n = scan_int();
988988 local p = to_direct(tex_getbox(n))
989- split_dir_head = nil
989+ if split_dir_head then node_free(split_dir_head); split_dir_head = nil end
990+ if split_dir_whatsit then split_dir_watsit = nil end
991+ split_dir_head = nil; split_dir_whatsit=nil
990992 if p then
991993 local bh = getlist(p)
992994 if getid(bh)==id_whatsit and getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR
@@ -1015,8 +1017,8 @@ do
10151017 if split_dir_whatsit then
10161018 -- adjust direction of 'split_keep'
10171019 set_attr(split_dir_whatsit, attr_dir, ltjs.list_dir)
1020+ split_dir_whatsit=nil
10181021 end
1019- split_dir_whatsit=nil
10201022 elseif gc=='preamble' then
10211023 split_dir_whatsit=nil
10221024 else
--- a/src/ltj-jfmglue.lua
+++ b/src/ltj-jfmglue.lua
@@ -1374,6 +1374,7 @@ do
13741374 local attr_yablshift = luatexbase.attributes['ltj@yablshift']
13751375 local attr_tablshift = luatexbase.attributes['ltj@tablshift']
13761376 local getcount, abs, scan_keyword = tex.getcount, math.abs, token.scan_keyword
1377+ local tex_nest = tex.nest
13771378 local get_current_jfont
13781379 do
13791380 local attr_curjfnt = luatexbase.attributes['ltj@curjfnt']
@@ -1389,7 +1390,7 @@ do
13891390 -- * (X)KANJI_SKIP(_JFM): その場で値が決まっている
13901391 -- * PROCESSED_BEGIN_FLAG + (X)KANJI_SKIP: 段落終了時に決める
13911392 local function insert_k_skip_common(ind, name, ica, icb)
1392- if abs(tex.nest[tex.nest.ptr].mode) ~= ltjs.hmode then return end
1393+ if abs(tex_nest[tex_nest.ptr].mode) ~= ltjs.hmode then return end
13931394 local g = node_new(id_glue); set_attr(g, attr_icflag, SPECIAL_JAGLUE)
13941395 local is_late = scan_keyword("late")
13951396 if not is_late then
--- a/src/ltj-jfont.lua
+++ b/src/ltj-jfont.lua
@@ -1023,12 +1023,12 @@ do
10231023 local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct
10241024 local ensure_tex_attr = ltjb.ensure_tex_attr
10251025 local node_write = node.direct.write
1026- local font = font
1026+ local fonts, tex_nest = font.fonts, tex.nest
10271027 local new_ic_kern = function(g) return node_new(id_kern,3) end
10281028 local dir_tate = luatexja.dir_table.dir_tate
10291029 -- EXT: italic correction
10301030 function luatexja.jfont.append_italic()
1031- local p = to_direct(tex.nest[tex.nest.ptr].tail)
1031+ local p = to_direct(tex_nest[tex_nest.ptr].tail)
10321032 local TEMP = node_new(id_kern)
10331033 if p and getid(p)==id_glyph then
10341034 if is_ucs_in_japanese_char(p) then
@@ -1040,10 +1040,10 @@ do
10401040 node_write(g); ensure_tex_attr(attr_icflag, 0)
10411041 else
10421042 local f = getfont(p)
1043- local h = font_getfont(f) or font.fonts[f]
1043+ local h = font_getfont(f) or fonts[f]
10441044 if h then
1045- local g = new_ic_kern()
10461045 if h.characters[getchar(p)] and h.characters[getchar(p)].italic then
1046+ local g = new_ic_kern()
10471047 setfield(g, 'kern', h.characters[getchar(p)].italic)
10481048 node_write(g); ensure_tex_attr(attr_icflag, 0)
10491049 end
--- a/src/ltj-lineskip.lua
+++ b/src/ltj-lineskip.lua
@@ -78,6 +78,7 @@ local p_dummy = ltjl.p_dummy
7878 local make_dir_whatsit = luatexja.direction.make_dir_whatsit
7979 local get_dir_count = luatexja.direction.get_dir_count
8080 local node_write = node.direct.write
81+local tex_nest = tex.nest
8182
8283 local function dir_adjust_append_vlist(b, loc, prev, mirrored)
8384 local old_b = to_direct(b)
@@ -87,7 +88,7 @@ local function dir_adjust_append_vlist(b, loc, prev, mirrored)
8788 local bw = texget('baselineskip', false)
8889 local normal = bw - prev - getfield(new_b, mirrored and 'depth' or 'height')
8990 local lmin, adj = nil, 0
90- local tail = to_direct(tex.nest[tex.nest.ptr].tail)
91+ local tail = to_direct(tex_nest[tex_nest.ptr].tail)
9192 if p_dummy~=ltj_profiler then
9293 while tail and (id_glue<=getid(tail)) and (getid(tail)<=id_penalty) do
9394 tail = node_prev(tail)
Show on old repository browser