-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
get_recent_screenshots (src-tauri/src/lib.rs:544-573) acquires both HistoryState and ThumbnailState mutexes simultaneously, then performs file existence checks and image thumbnail generation (file IO + image decoding + base64 encoding) while holding both locks:
let history = history_state.lock().unwrap();
let thumbnail_gen = thumbnail_state.lock().unwrap();
for screenshot in recent_screenshots {
// file I/O + image processing while holding both locks
let thumbnail_base64 = if Path::new(&screenshot.file_path).exists() {
thumbnail_gen.get_thumbnail_base64(...)
} ...
}Impact
- Any other Tauri command needing either mutex (e.g.,
save_to_disk,delete_screenshot) will block until all thumbnails are generated. - With 10 screenshots and cache misses, this could take several seconds, freezing the UI for other operations.
Suggested fix
Clone the screenshot list while holding the history lock, drop it, then generate thumbnails with only the thumbnail lock (or better, move thumbnail generation to a non-locking async task).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request