From 78754ff3ac0ae179732af37e1f30d931400272ab Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 18 Feb 2023 15:21:44 -0800 Subject: [PATCH] macos: clean up surface on close --- macos/Sources/TerminalSurfaceView.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/macos/Sources/TerminalSurfaceView.swift b/macos/Sources/TerminalSurfaceView.swift index 0987c48a0..6f54a80f8 100644 --- a/macos/Sources/TerminalSurfaceView.swift +++ b/macos/Sources/TerminalSurfaceView.swift @@ -182,6 +182,11 @@ class TerminalSurfaceView_Real: NSView, NSTextInputClient, ObservableObject { fatalError("init(coder:) is not supported for this view") } + deinit { + guard let surface = self.surface else { return } + ghostty_surface_free(surface) + } + override func resize(withOldSuperviewSize oldSize: NSSize) { super.resize(withOldSuperviewSize: oldSize)