mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Fixes a crash in macOS 26
This commit is contained in:
parent
ba7d66aa88
commit
3c31ae0692
3 changed files with 27 additions and 9 deletions
|
|
@ -92,12 +92,8 @@ struct VTCommandPageView: View {
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.padding()
|
.padding()
|
||||||
.onAppear {
|
.onAppear {
|
||||||
Task {
|
// Check installation status synchronously on appear
|
||||||
// This happens on startup, but we wanna refresh before showing.
|
cliInstaller.checkInstallationStatus()
|
||||||
await MainActor.run {
|
|
||||||
cliInstaller.checkInstallationStatus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,10 +123,19 @@ struct WelcomeView: View {
|
||||||
currentPage += 1
|
currentPage += 1
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Finish action - open Settings
|
// Finish action - save welcome version and close window
|
||||||
welcomeVersion = AppConstants.currentWelcomeVersion
|
welcomeVersion = AppConstants.currentWelcomeVersion
|
||||||
dismiss()
|
|
||||||
SettingsOpener.openSettings()
|
// Close the window properly through the window controller
|
||||||
|
if let window = NSApp.windows.first(where: { $0.contentViewController is NSHostingController<WelcomeView> }) {
|
||||||
|
window.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open settings after a delay to ensure the window is fully closed
|
||||||
|
Task { @MainActor in
|
||||||
|
try? await Task.sleep(for: .milliseconds(200))
|
||||||
|
SettingsOpener.openSettings()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,9 @@ final class WelcomeWindowController: NSWindowController, NSWindowDelegate {
|
||||||
window.isReleasedWhenClosed = false
|
window.isReleasedWhenClosed = false
|
||||||
// Use normal window level instead of floating
|
// Use normal window level instead of floating
|
||||||
window.level = .normal
|
window.level = .normal
|
||||||
|
|
||||||
|
// Set content view mode to ensure proper cleanup
|
||||||
|
hostingController.sizingOptions = [.preferredContentSize]
|
||||||
|
|
||||||
super.init(window: window)
|
super.init(window: window)
|
||||||
|
|
||||||
|
|
@ -76,6 +79,16 @@ final class WelcomeWindowController: NSWindowController, NSWindowDelegate {
|
||||||
private func handleShowWelcomeNotification() {
|
private func handleShowWelcomeNotification() {
|
||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - NSWindowDelegate
|
||||||
|
|
||||||
|
func windowWillClose(_ notification: Notification) {
|
||||||
|
// Ensure any async tasks are cancelled
|
||||||
|
Task { @MainActor in
|
||||||
|
// Give SwiftUI time to clean up
|
||||||
|
try? await Task.sleep(for: .milliseconds(100))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue