Skip to content

Commit

Permalink
fix(tauri-runtime-wry): window draw span not closing (#9717)
Browse files Browse the repository at this point in the history
* fix(tauri-runtime-wry): window draw span not closing

* use .retain
  • Loading branch information
lucasfernog committed May 9, 2024
1 parent fedca73 commit c0bcc6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-draw-tracing.md
@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch:bug
---

Fixes redraw tracing span not closing.
22 changes: 10 additions & 12 deletions core/tauri-runtime-wry/src/lib.rs
Expand Up @@ -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: _ }));
}
}

Expand Down Expand Up @@ -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) {
Expand All @@ -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(
Expand Down

0 comments on commit c0bcc6c

Please sign in to comment.