Skip to content

Commit c0bcc6c

Browse files
authored
fix(tauri-runtime-wry): window draw span not closing (#9717)
* fix(tauri-runtime-wry): window draw span not closing * use .retain
1 parent fedca73 commit c0bcc6c

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

.changes/fix-draw-tracing.md

Lines changed: 5 additions & 0 deletions
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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,11 @@ pub struct ActiveTraceSpanStore(Rc<RefCell<Vec<ActiveTracingSpan>>>);
345345

346346
#[cfg(feature = "tracing")]
347347
impl ActiveTraceSpanStore {
348-
pub fn remove_window_draw(&self, window_id: TaoWindowId) {
349-
let mut store = self.0.borrow_mut();
350-
if let Some(index) = store
351-
.iter()
352-
.position(|t| matches!(t, ActiveTracingSpan::WindowDraw { id, span: _ } if id == &window_id))
353-
{
354-
store.remove(index);
355-
}
348+
pub fn remove_window_draw(&self) {
349+
self
350+
.0
351+
.borrow_mut()
352+
.retain(|t| !matches!(t, ActiveTracingSpan::WindowDraw { id: _, span: _ }));
356353
}
357354
}
358355

@@ -3242,9 +3239,8 @@ fn handle_event_loop<T: UserEvent>(
32423239
callback(RunEvent::Exit);
32433240
}
32443241

3245-
#[cfg(any(feature = "tracing", windows))]
3242+
#[cfg(windows)]
32463243
Event::RedrawRequested(id) => {
3247-
#[cfg(windows)]
32483244
if let Some(window_id) = window_id_map.get(&id) {
32493245
let mut windows_ref = windows.0.borrow_mut();
32503246
if let Some(window) = windows_ref.get_mut(&window_id) {
@@ -3257,9 +3253,11 @@ fn handle_event_loop<T: UserEvent>(
32573253
}
32583254
}
32593255
}
3256+
}
32603257

3261-
#[cfg(feature = "tracing")]
3262-
active_tracing_spans.remove_window_draw(id);
3258+
#[cfg(feature = "tracing")]
3259+
Event::RedrawEventsCleared => {
3260+
active_tracing_spans.remove_window_draw();
32633261
}
32643262

32653263
Event::UserEvent(Message::Webview(

0 commit comments

Comments
 (0)