Skip to content

Commit

Permalink
Fix: crash due to dangling DbAccessor
Browse files Browse the repository at this point in the history
  • Loading branch information
ksqsf committed Jan 9, 2025
1 parent c529071 commit 83122fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/kagiroi/kagiroi_dict.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function Module.release()
return
end
if Module.dic_db and Module.dic_db:loaded() then
collectgarbage()
Module.dic_db:close()
end
end
Expand Down
1 change: 1 addition & 0 deletions lua/kagiroi/kagiroi_viterbi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ function Module.init()
end

function Module.fini()
Module.lattice = nil
Module.kagiroi_dict.release()
end

Expand Down
7 changes: 7 additions & 0 deletions tests/kagiroi.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ deploy:
tests:
- send: 'aida{Control+c}'
assert: cand[1].text == "あいだ" and cand[2].text == "アイダ" and cand[3].text == "アイダ"

nocrash:
tests:
- send: nani{space}
assert: true
- send: nani{space}
assert: true

0 comments on commit 83122fe

Please sign in to comment.