fix: a panic on one thread no longer takes the whole app down
Every shared lock was std::sync::Mutex with lock().unwrap() (~150 sites), so a panic in any session's reader or callback poisoned the lock and the next UI frame panicked too, dropping every open session. Locks are now parking_lot::Mutex (no poisoning; already in the dependency tree), and a panic hook reports worker panics as an error toast instead of the session silently stopping (F3, F4).
This commit is contained in:
@@ -8,7 +8,8 @@ use chrono::{DateTime, Utc};
|
||||
use egui::{Color32, RichText, Sense, Ui, vec2};
|
||||
use egui_phosphor::regular as icon;
|
||||
use nexus_core::models::GitHubRepo;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use parking_lot::Mutex;
|
||||
use std::sync::Arc;
|
||||
|
||||
enum Msg {
|
||||
Repos(Vec<GitHubRepo>),
|
||||
@@ -175,7 +176,7 @@ impl GithubView {
|
||||
Ok(r) => Msg::Repos(r),
|
||||
Err(e) => Msg::RefreshFailed(e.to_string()),
|
||||
};
|
||||
inbox.lock().unwrap().push(msg);
|
||||
inbox.lock().push(msg);
|
||||
ctx.request_repaint();
|
||||
});
|
||||
}
|
||||
@@ -193,13 +194,13 @@ impl GithubView {
|
||||
Ok(()) => Msg::Downloaded(full, path.display().to_string()),
|
||||
Err(e) => Msg::DownloadFailed(e.to_string()),
|
||||
};
|
||||
inbox.lock().unwrap().push(msg);
|
||||
inbox.lock().push(msg);
|
||||
ctx.request_repaint();
|
||||
});
|
||||
}
|
||||
|
||||
pub fn ui(&mut self, ui: &mut Ui, s: &mut Shared) {
|
||||
let msgs = std::mem::take(&mut *self.inbox.lock().unwrap());
|
||||
let msgs = std::mem::take(&mut *self.inbox.lock());
|
||||
for m in msgs {
|
||||
match m {
|
||||
Msg::Repos(r) => {
|
||||
|
||||
Reference in New Issue
Block a user