[中] 音频预览生成的临时 WAV 从不删除

Open
#18 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
desktop

Research direction

Start at render_audio_preview() in windows/birdlock/app/state.py (1292-1322), where tempfile.mkstemp() writes the WAV, then follow _audio_wav_cache through _start_audio() (:788) and clear() (:1243), which drops the dict without unlinking. Compare the temp-file handling in windows/birdlock/core/exporter.py:492-503 before choosing either a fixed preview filename or an unlink-on-clear/close map. Done looks like previewing several segments, then finding no leftover WAVs in the temp directory and playback still working after the cache is emptied.

Written by the indexing model from the issue text.

Description

位置:windows/birdlock/app/state.py:1292-1322、:788、:1243;windows/birdlock/core/exporter.py:492-503

现象:render_audio_preview() 用 tempfile.mkstemp() 在系统临时目录生成 WAV,_start_audio() 只把路径放进 _audio_wav_cache;clear() 只清字典不删文件。每次在不同位置开始预览都会留下一个文件,缓存被系统清理后还会导致 _play_wav() 静默失败。

复现:反复播放不同片段后检查系统临时目录。

建议:改用固定命名的预览文件并在替换/关闭时删除,或维护映射并在 clear/close 时逐个 unlink。

来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在 Windows 实机复现,复现路径由代码审计推得。

Dominant language
Swift
Stars
2
Forks
2
Avg merge
1h 11m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cyandee/BirdLock

All issues in cyandee/BirdLock

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.