Skip to content

Commit 2eb2137

Browse files
authored
fix(tauri-runtime-wry): window draw span not closing (#9718)
* fix(tauri-runtime-wry): window draw span not closing * use .retain
1 parent ab9ec42 commit 2eb2137

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

.changes/fix-draw-tracing.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-runtime-wry": patch:bug
3+
---
4+
5+
Fixes redraw tracing span not closing.

core/tauri-runtime-wry/src/lib.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,11 @@ pub struct ActiveTraceSpanStore(Rc<RefCell<Vec<ActiveTracingSpan>>>);
248248

249249
#[cfg(feature = "tracing")]
250250
impl ActiveTraceSpanStore {
251-
pub fn remove_window_draw(&self, window_id: WindowId) {
252-
let mut store = self.0.borrow_mut();
253-
if let Some(index) = store
254-
.iter()
255-
.position(|t| matches!(t, ActiveTracingSpan::WindowDraw { id, span: _ } if id == &window_id))
256-
{
257-
store.remove(index);
258-
}
251+
pub fn remove_window_draw(&self) {
252+
self
253+
.0
254+
.borrow_mut()
255+
.retain(|t| !matches!(t, ActiveTracingSpan::WindowDraw { id: _, span: _ }));
259256
}
260257
}
261258

@@ -2839,8 +2836,8 @@ fn handle_event_loop<T: UserEvent>(
28392836
}
28402837

28412838
#[cfg(feature = "tracing")]
2842-
Event::RedrawRequested(id) => {
2843-
active_tracing_spans.remove_window_draw(id);
2839+
Event::RedrawEventsCleared => {
2840+
active_tracing_spans.remove_window_draw();
28442841
}
28452842

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

0 commit comments

Comments
 (0)