Skip to content

[audit] fix: wrap statusline autocmds in an augroup - #323

Draft
stanfish06 wants to merge 1 commit into
masterfrom
audit/statusline-augroup-leak
Draft

[audit] fix: wrap statusline autocmds in an augroup#323
stanfish06 wants to merge 1 commit into
masterfrom
audit/statusline-augroup-leak

Conversation

@stanfish06

Copy link
Copy Markdown
Owner

What

Wraps the three autocmds in lua/config/statusline.lua (two ColorScheme handlers and the LspProgress handler) in a single nvim_create_augroup("Statusline", { clear = true }), mirroring the pattern already used in orgview.lua, scopeline.lua, treesitter.lua, and the tabline_timer fix in options.lua.

Where

lua/config/statusline.lua:4, :106, :217 (pre-change line numbers).

Why it matters

None of these three autocmds were registered under an augroup. This repo's own dev notes (init.lua comments, and the tabline_timer handling in options.lua) treat :source % on individual config files as a normal iterative-dev workflow, and other modules already guard against the fallout with clear = true augroups.

Without a group, re-sourcing statusline.lua stacks a second LspProgress autocmd. That new closure owns its own lsp_progress table and its own vim.uv.new_timer() (line 84), but the global StatusLine()/current_lsp_progress() functions get overwritten by the re-source, so nothing ever reads the old closure's table again — its timer is orphaned exactly like the previously-fixed tabline_timer leak, and keeps firing redrawstatus every 100ms for as long as the stale closure keeps seeing LSP progress events.

Fix

Create one augroup local and pass group = augroup to all three nvim_create_autocmd calls. No behavior change on a fresh (non-resourced) start; only affects the re-source workflow.


Generated by Claude Code

ColorScheme (x2) and LspProgress were registered with no augroup,
unlike every other config module in this repo. Re-sourcing
statusline.lua (a supported workflow per this repo's own dev notes)
stacks a second LspProgress autocmd whose closure owns its own
lsp_progress table and its own vim.uv timer; the stale timer is
never cleaned up and keeps firing redrawstatus every 100ms, the same
orphaned-timer failure mode already fixed for tabline_timer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants