Skip to content

Commit

Permalink
Fix the memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusSkucas committed Nov 25, 2021
1 parent 044d834 commit dc3e28f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SLAM/SLAMApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, SHSessionDelegate {
@objc func closeMainWindow(_ notification: Notification) {
mainWindow?.close()
openedWindowCount += 1

if openedWindowCount >= 10 { // lol
let task = Process()
var args = [String]()
args.append("-c")
let bundle = Bundle.main.bundlePath
args.append("sleep 0.2; open \"\(bundle)\"")
task.launchPath = "/bin/sh"
task.arguments = args
task.launch()
NSApplication.shared.terminate(nil)
}
}
}

Expand Down

0 comments on commit dc3e28f

Please sign in to comment.