Skip to content

fix: Nested background threads leaking#56

Merged
dmtrKovalenko merged 1 commit into
mainfrom
fix/watcher-leak
Aug 4, 2025
Merged

fix: Nested background threads leaking#56
dmtrKovalenko merged 1 commit into
mainfrom
fix/watcher-leak

Conversation

@dmtrKovalenko
Copy link
Copy Markdown
Owner

@dmtrKovalenko dmtrKovalenko commented Aug 4, 2025

fixes #49

@dmtrKovalenko dmtrKovalenko force-pushed the fix/watcher-leak branch 2 times, most recently from 8e76441 to 7a6c014 Compare August 4, 2025 14:43
@dmtrKovalenko dmtrKovalenko requested a review from Copilot August 4, 2025 14:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a critical issue where background threads in the file picker were leaking when the application was shut down or reinitialized. The fix implements proper cleanup mechanisms using a debouncer-based approach instead of the previous shutdown signal pattern.

  • Replaces the shutdown signal approach with proper resource management using a debouncer wrapper
  • Adds explicit cleanup functionality for stopping background monitors and cleaning up file pickers
  • Implements automatic cleanup on Neovim exit via autocmd

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lua/fff/rust/file_picker.rs Refactors background thread management to use debouncer-based cleanup instead of shutdown signals
lua/fff/rust/lib.rs Adds cleanup functions and updates error handling for file picker operations
lua/fff/rust/error.rs Simplifies error types and adds proper error logging
lua/fff/rust/tracing.rs Simplifies error handling for directory creation
lua/fff/main.lua Adds VimLeavePre autocmd for automatic cleanup and refactors function naming
lua/fff/fuzzy.lua Exposes new cleanup_file_picker function
Comments suppressed due to low confidence (1)

lua/fff/rust/file_picker.rs:167

  • Explicit drop(picker) is redundant since take() already transfers ownership and the value will be dropped automatically at the end of the scope.
    fn from(file: &FileItem) -> Self {

Comment thread lua/fff/rust/file_picker.rs
Comment thread lua/fff/main.lua Outdated
Comment thread lua/fff/main.lua Outdated
@dmtrKovalenko dmtrKovalenko merged commit 9e51132 into main Aug 4, 2025
6 checks passed
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.

Potential memory leak

2 participants