Commit df1f25b
fix(045): remove broad catch{} swallows in tear-off pipeline (#420)
PR #418 (Spec 045 §2.6 VS-style immediate tab tear-off) landed with 14
broad catch{} blocks across the tear-off code paths. Most were
dead-defensive: the ReactorWindow public mutators (Close, Hide, Activate,
SetOpacity, SetNoActivate, SetIgnorePointerInput) are all no-op on
_disposed and internally narrow the teardown-COMException set, so an
outer catch swallowed nothing.
Changes per issue #420 inventory:
DockTabTearOff.cs (1 site)
• PositionFloating tracker-tick catch removed. Audited Stop-before-Close
ordering: every path that closes the floating window calls Stop()
first (detaches Tick handler, clears s_active), so AppWindow.Move
always targets a live AppWindow.
DockHostNativeComponent.cs (4 sites → 0)
• BeginImmediateTearOff: DockFloatingWindow.Open catch removed.
Open failure is a bug we want to surface; layout mutation is
deferred until after Open returns.
• FinalizeImmediateDrop: two floatingWindow.Close catches removed.
ReactorWindow.Close is idempotent; called once per branch.
• FinalizeImmediateDrop drop-outside: strip-drag-styles catch removed.
All four mutators are disposal-safe.
DockFloatingWindow.cs (9 sites → 0, plus 1 latent bug fix)
• BeginFloatingTearOff source-XamlRoot read: catch removed.
• BeginFloatingTearOff Open call: catch removed.
• Single-tab path: ownWindow.AppWindow.Hide() → ownWindow.Hide().
The bare AppWindow.Hide() bypassed ReactorWindow.Hide's _disposed
guard and teardown-COMException catch; the wrapper has both.
• Multi-tab path SetIgnorePointerInput(true) — latent bug fix.
The call requires WS_EX_LAYERED. A regular floating window opens
with Opacity=1.0 (not layered), so SetIgnorePointerInput(true)
was throwing InvalidOperationException every multi-tab tear-off,
silently swallowed — the source window was never actually marked
click-through despite the comment claiming it was. Now nudge
SetOpacity(0.9999) first to install WS_EX_LAYERED (alpha rounds
to 255 → visually identical).
• RestoreSourcePointerInput catch removed; also restores SetOpacity(1.0)
to undo the layering nudge.
• Two capturedDragged.Close catches (enqueued + sync fallback) removed.
• Fallback xr ??= capturedDragged.NativeWindow?.Content?.XamlRoot
catch removed (window was just opened synchronously).
• RestoreWindowFromDrag four-setter catch removed (all disposal-safe).
Three explicitly out-of-scope catches in DockTabTearOff.cs are preserved
per the issue:
• L191 TabView.CapturePointer (best-effort, can fail on stale pointer)
• L256 TabView.ReleasePointerCaptures (no captures → no-op)
• L502 active.CancelDrop in Tracker.ForceCancel (must not crash next drag)
Verified: dotnet test Reactor.Tests on ARM64 — 9038 passed, 0 failed.
The selftest fixtures (T07/T08 host tear-off, T11-T14 floating tear-off)
check Spec.Opacity >= 0.99 on restore; the 0.9999 layering nudge plus
the explicit SetOpacity(1.0) restore satisfy those assertions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 005ecae commit df1f25b
3 files changed
Lines changed: 122 additions & 86 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
545 | | - | |
546 | | - | |
547 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
548 | 550 | | |
549 | 551 | | |
550 | 552 | | |
| |||
564 | 566 | | |
565 | 567 | | |
566 | 568 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
579 | 582 | | |
580 | 583 | | |
581 | 584 | | |
| |||
594 | 597 | | |
595 | 598 | | |
596 | 599 | | |
597 | | - | |
598 | | - | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
599 | 607 | | |
600 | 608 | | |
601 | 609 | | |
602 | | - | |
603 | | - | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
604 | 633 | | |
605 | 634 | | |
606 | 635 | | |
| |||
617 | 646 | | |
618 | 647 | | |
619 | 648 | | |
620 | | - | |
621 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
622 | 655 | | |
623 | | - | |
624 | | - | |
| 656 | + | |
| 657 | + | |
625 | 658 | | |
626 | 659 | | |
627 | 660 | | |
628 | 661 | | |
629 | 662 | | |
630 | 663 | | |
631 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
632 | 670 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
| 671 | + | |
| 672 | + | |
638 | 673 | | |
639 | 674 | | |
640 | 675 | | |
| |||
652 | 687 | | |
653 | 688 | | |
654 | 689 | | |
655 | | - | |
656 | | - | |
657 | | - | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
658 | 694 | | |
659 | 695 | | |
660 | 696 | | |
| |||
669 | 705 | | |
670 | 706 | | |
671 | 707 | | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
680 | 721 | | |
681 | 722 | | |
682 | 723 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
495 | 491 | | |
496 | 492 | | |
497 | 493 | | |
| |||
576 | 572 | | |
577 | 573 | | |
578 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
579 | 579 | | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
| 580 | + | |
| 581 | + | |
589 | 582 | | |
590 | 583 | | |
591 | 584 | | |
592 | 585 | | |
593 | 586 | | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
603 | 594 | | |
604 | 595 | | |
605 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
562 | 566 | | |
563 | 567 | | |
564 | 568 | | |
| |||
0 commit comments