macos: free inspector when it is hidden

This commit is contained in:
Mitchell Hashimoto
2023-10-25 09:09:10 -07:00
parent a6c765d1c0
commit 1696cf76b6

View File

@ -253,7 +253,14 @@ extension Ghostty {
}
// True if the inspector should be visible
@Published var inspectorVisible: Bool = false
@Published var inspectorVisible: Bool = false {
didSet {
if (oldValue && !inspectorVisible) {
guard let surface = self.surface else { return }
ghostty_inspector_free(surface)
}
}
}
private(set) var surface: ghostty_surface_t?
var error: Error? = nil