mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-09 11:55:53 +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)
|
||||
.padding()
|
||||
.onAppear {
|
||||
Task {
|
||||
// This happens on startup, but we wanna refresh before showing.
|
||||
await MainActor.run {
|
||||
cliInstaller.checkInstallationStatus()
|
||||
}
|
||||
}
|
||||
// Check installation status synchronously on appear
|
||||
cliInstaller.checkInstallationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,10 +123,19 @@ struct WelcomeView: View {
|
|||
currentPage += 1
|
||||
}
|
||||
} else {
|
||||
// Finish action - open Settings
|
||||
// Finish action - save welcome version and close window
|
||||
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
|
||||
// Use normal window level instead of floating
|
||||
window.level = .normal
|
||||
|
||||
// Set content view mode to ensure proper cleanup
|
||||
hostingController.sizingOptions = [.preferredContentSize]
|
||||
|
||||
super.init(window: window)
|
||||
|
||||
|
|
@ -76,6 +79,16 @@ final class WelcomeWindowController: NSWindowController, NSWindowDelegate {
|
|||
private func handleShowWelcomeNotification() {
|
||||
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