Add nil guard in forceRefresh() to prevent dereferencing freed surface pointer. Split else-if chains in Workspace.swift so requestBackgroundSurfaceStartIfNeeded() runs if surface is freed during the refresh call. Add regression test exercising the crash path.
This commit is contained in:
parent
9ae737026d
commit
dca8992901
3 changed files with 80 additions and 16 deletions
|
|
@ -3083,8 +3083,10 @@ final class Workspace: Identifiable, ObservableObject {
|
|||
// layout and view lifecycle changes that free surfaces (#432).
|
||||
if terminalPanel.surface.surface != nil {
|
||||
terminalPanel.surface.forceRefresh()
|
||||
} else if isAttached && hasUsableBounds {
|
||||
}
|
||||
if terminalPanel.surface.surface == nil, isAttached && hasUsableBounds {
|
||||
terminalPanel.surface.requestBackgroundSurfaceStartIfNeeded()
|
||||
needsFollowUpPass = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3139,7 +3141,8 @@ final class Workspace: Identifiable, ObservableObject {
|
|||
panel.hostedView.reconcileGeometryNow()
|
||||
if panel.surface.surface != nil {
|
||||
panel.surface.forceRefresh()
|
||||
} else {
|
||||
}
|
||||
if panel.surface.surface == nil {
|
||||
panel.surface.requestBackgroundSurfaceStartIfNeeded()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue