Skip to content

Commit

Permalink
fix(tauri-runtime-wry): window draw span not closing (#9718)
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 authored May 9, 2024
1 parent ab9ec42 commit 2eb2137
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-draw-tracing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch:bug
---

Fixes redraw tracing span not closing.
17 changes: 7 additions & 10 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,11 @@ pub struct ActiveTraceSpanStore(Rc<RefCell<Vec<ActiveTracingSpan>>>);

#[cfg(feature = "tracing")]
impl ActiveTraceSpanStore {
pub fn remove_window_draw(&self, window_id: WindowId) {
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 @@ -2839,8 +2836,8 @@ fn handle_event_loop<T: UserEvent>(
}

#[cfg(feature = "tracing")]
Event::RedrawRequested(id) => {
active_tracing_spans.remove_window_draw(id);
Event::RedrawEventsCleared => {
active_tracing_spans.remove_window_draw();
}

#[cfg(all(desktop, feature = "global-shortcut"))]
Expand Down

0 comments on commit 2eb2137

Please sign in to comment.