fix(tauri-runtime-wry): window draw span not closing (#9717)

* fix(tauri-runtime-wry): window draw span not closing

* use .retain
This commit is contained in:
Lucas Fernandes Nogueira 2024-05-09 10:09:41 -03:00 committed by GitHub
parent fedca73860
commit c0bcc6c0b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 12 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch:bug
---
Fixes redraw tracing span not closing.

View File

@ -345,14 +345,11 @@ pub struct ActiveTraceSpanStore(Rc<RefCell<Vec<ActiveTracingSpan>>>);
#[cfg(feature = "tracing")]
impl ActiveTraceSpanStore {
pub fn remove_window_draw(&self, window_id: TaoWindowId) {
let mut store = self.0.borrow_mut();
if let Some(index) = store
.iter()
.position(|t| matches!(t, ActiveTracingSpan::WindowDraw { id, span: _ } if id == &window_id))
{
store.remove(index);
}
pub fn remove_window_draw(&self) {
self
.0
.borrow_mut()
.retain(|t| !matches!(t, ActiveTracingSpan::WindowDraw { id: _, span: _ }));
}
}
@ -3242,9 +3239,8 @@ fn handle_event_loop<T: UserEvent>(
callback(RunEvent::Exit);
}
#[cfg(any(feature = "tracing", windows))]
#[cfg(windows)]
Event::RedrawRequested(id) => {
#[cfg(windows)]
if let Some(window_id) = window_id_map.get(&id) {
let mut windows_ref = windows.0.borrow_mut();
if let Some(window) = windows_ref.get_mut(&window_id) {
@ -3257,9 +3253,11 @@ fn handle_event_loop<T: UserEvent>(
}
}
}
}
#[cfg(feature = "tracing")]
active_tracing_spans.remove_window_draw(id);
#[cfg(feature = "tracing")]
Event::RedrawEventsCleared => {
active_tracing_spans.remove_window_draw();
}
Event::UserEvent(Message::Webview(