mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Prevent UI lockup by doing try_lock() in a few places, and rendering -1 if we couldn't get a lock
This commit is contained in:
parent
aeab81ce62
commit
1b8ea9d447
@ -14,11 +14,15 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
|
|
||||||
//let screen_rect = ctx.input().screen_rect; // Rect
|
//let screen_rect = ctx.input().screen_rect; // Rect
|
||||||
|
|
||||||
let desired_count = {
|
Globals::trim_desired_events_sync();
|
||||||
Globals::trim_desired_events_sync();
|
let desired_count: isize = match GLOBALS.desired_events.try_read() {
|
||||||
GLOBALS.desired_events.blocking_read().len()
|
Ok(v) => v.len() as isize,
|
||||||
|
Err(_) => -1,
|
||||||
|
};
|
||||||
|
let incoming_count: isize = match GLOBALS.incoming_events.try_read() {
|
||||||
|
Ok(v) => v.len() as isize,
|
||||||
|
Err(_) => -1,
|
||||||
};
|
};
|
||||||
let incoming_count = GLOBALS.incoming_events.blocking_read().len();
|
|
||||||
|
|
||||||
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
||||||
if ui
|
if ui
|
||||||
@ -48,7 +52,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ui.button("▶ close all" ).clicked() {
|
if ui.button("▶ close all").clicked() {
|
||||||
app.hides = feed.clone();
|
app.hides = feed.clone();
|
||||||
}
|
}
|
||||||
if ui.button("▼ open all").clicked() {
|
if ui.button("▼ open all").clicked() {
|
||||||
|
Loading…
Reference in New Issue
Block a user