Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(app): read Windows app icons one at a time

Manas Raghuwanshi3f1daba0d063
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/icons.rs b/apps/screenpipe-app-tauri/src-tauri/src/icons.rs
index fac2118ee..f762f4a63 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/icons.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/icons.rs
@@ -173,7 +173,16 @@ fn windows_app_icon(app_name: &str, app_path: Option<String>) -> Result<Option<A
.ok_or_else(|| "app_path is None and could not find executable path".to_string())?,
};
- let image_buffer = get_icon_by_path(&path).map_err(|e| e.to_string())?;
+ // One icon read at a time: when the first reads in a process overlap, about
+ // 1 in 7 fail with "Failed to get icon info", and none do when serialized.
+ static ICON_READS: std::sync::Mutex<()> = std::sync::Mutex::new(());
+ let image_buffer = {
+ let _one_at_a_time = ICON_READS
+ .lock()
+ .unwrap_or_else(std::sync::PoisonError::into_inner);
+ get_icon_by_path(&path)
+ }
+ .map_err(|e| e.to_string())?;
let mut data = Vec::new();
{