fix: use mutex poisoning recovery in bookmarks plugin
This commit is contained in:
@@ -229,7 +229,7 @@ impl BookmarksState {
|
||||
fn load_bookmarks(&self) {
|
||||
// Fast path: load from cache immediately
|
||||
{
|
||||
let mut items = self.items.lock().unwrap();
|
||||
let mut items = self.items.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if items.is_empty() {
|
||||
*items = Self::load_cached_bookmarks();
|
||||
}
|
||||
@@ -262,7 +262,9 @@ impl BookmarksState {
|
||||
Self::save_cached_bookmarks(&items);
|
||||
|
||||
// Update shared state so subsequent refreshes see the new data
|
||||
*shared_items.lock().unwrap() = items;
|
||||
if let Ok(mut shared) = shared_items.lock() {
|
||||
*shared = items;
|
||||
}
|
||||
|
||||
loading.store(false, Ordering::SeqCst);
|
||||
});
|
||||
@@ -549,7 +551,7 @@ extern "C" fn provider_refresh(handle: ProviderHandle) -> RVec<PluginItem> {
|
||||
state.load_bookmarks();
|
||||
|
||||
// Return items
|
||||
let items = state.items.lock().unwrap();
|
||||
let items = state.items.lock().unwrap_or_else(|e| e.into_inner());
|
||||
items.to_vec().into()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user