Commit a884a3d
fix: prevent terminal crash on resize during high-output programs
Cancel the render loop before WASM resize to prevent accessing detached
TypedArray views when buffers are reallocated. Restart render loop and
flush any queued writes synchronously after resize completes.
This avoids the background-tab regression from PR #114's approach of
using an isResizing flag cleared via requestAnimationFrame (rAF is
throttled/paused in background tabs, causing writes to queue
indefinitely).
Changes:
- terminal.ts: Add cancelRenderLoop()/flushWriteQueue(), wrap resize()
in try/catch with render loop pause/restart, add defensive writeQueue
- ghostty.ts: Invalidate grapheme buffers in invalidateBuffers()
alongside viewport buffers to prevent stale TypedArray access
Co-authored-by: 0xBigBoss <95193764+0xBigBoss@users.noreply.github.com>1 parent 3525675 commit a884a3d
2 files changed
+60
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
877 | 882 | | |
878 | 883 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
660 | 661 | | |
661 | 662 | | |
662 | 663 | | |
663 | | - | |
664 | | - | |
665 | | - | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
666 | 669 | | |
667 | | - | |
668 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
669 | 680 | | |
670 | | - | |
671 | | - | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
672 | 687 | | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
| 688 | + | |
| 689 | + | |
679 | 690 | | |
680 | | - | |
681 | | - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
682 | 696 | | |
683 | | - | |
684 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
685 | 700 | | |
686 | 701 | | |
687 | 702 | | |
| |||
1068 | 1083 | | |
1069 | 1084 | | |
1070 | 1085 | | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1076 | 1089 | | |
1077 | 1090 | | |
1078 | 1091 | | |
| |||
1112 | 1125 | | |
1113 | 1126 | | |
1114 | 1127 | | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1115 | 1148 | | |
1116 | 1149 | | |
1117 | 1150 | | |
| |||
0 commit comments