Skip to content

Commit 7d12f22

Browse files
committed
fix(desktop-gpui): retry thumbnail sweeps a capture hang cut short
A sweep sends its target list before capturing, and the receiver commits that list's signature when the channel closes. A sweep that a hang ended early was therefore recorded as complete, and with an unchanged window list windows_stale() stayed false, so window thumbnails never retried after the pause. Skip the commit while captures are paused so the picker retries the sweep once the pause lifts. Also add the pause duration with Duration::saturating_sub in the test, per the repository's time-subtraction rule.
1 parent 55c7a9c commit 7d12f22

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎apps/desktop-gpui/src/main_window.rs‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,9 +1269,13 @@ impl MainWindow {
12691269
// `setDisplayThumbnailsSignature` runs
12701270
// (`new-main/index.tsx:2617-2620`). Committing the
12711271
// signature at `Listed` time instead would mark a sweep
1272-
// that never landed as up to date.
1272+
// that never landed as up to date. Likewise a sweep that a
1273+
// capture hang cut short: it stays stale so the picker
1274+
// retries it once the pause lifts.
12731275
this.update(cx, |this, cx| {
1274-
if let Some(signature) = swept {
1276+
if let Some(signature) = swept
1277+
&& !target_thumbnails::captures_paused()
1278+
{
12751279
this.thumbnails.set_display_signature(signature);
12761280
}
12771281
this.thumbnails.set_display_inflight(false);
@@ -1316,7 +1320,9 @@ impl MainWindow {
13161320
}
13171321
}
13181322
this.update(cx, |this, cx| {
1319-
if let Some(signature) = swept {
1323+
if let Some(signature) = swept
1324+
&& !target_thumbnails::captures_paused()
1325+
{
13201326
this.thumbnails.set_window_signature(signature);
13211327
}
13221328
this.thumbnails.set_window_inflight(false);

‎apps/desktop-gpui/src/target_thumbnails.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ mod tests {
15711571
assert!(!pause.active_at(now));
15721572
pause.start_at(now);
15731573
assert!(pause.active_at(now));
1574-
assert!(pause.active_at(now + CAPTURE_HANG_PAUSE - Duration::from_millis(1)));
1574+
assert!(pause.active_at(now + CAPTURE_HANG_PAUSE.saturating_sub(Duration::from_millis(1))));
15751575
assert!(!pause.active_at(now + CAPTURE_HANG_PAUSE));
15761576
}
15771577
}

0 commit comments

Comments
 (0)