1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Ensures a machine exists before messaging it.

This commit is contained in:
Thomas Harte 2019-03-02 21:27:34 -05:00
parent 5b56ad0d78
commit 2beeaa513b
2 changed files with 16 additions and 14 deletions

View File

@ -68,7 +68,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES"

View File

@ -199,20 +199,22 @@ class MachineDocument:
// MARK: CSOpenGLViewDelegate
final func openGLViewRedraw(_ view: CSOpenGLView, event redrawEvent: CSOpenGLViewRedrawEvent) {
switch redrawEvent {
case .timer:
bestEffortLock.lock()
if let bestEffortUpdater = bestEffortUpdater {
bestEffortLock.unlock()
bestEffortUpdater.update()
} else {
bestEffortLock.unlock()
}
self.machine.updateView(forPixelSize: view.backingSize)
fallthrough
if let machine = self.machine {
switch redrawEvent {
case .timer:
bestEffortLock.lock()
if let bestEffortUpdater = bestEffortUpdater {
bestEffortLock.unlock()
bestEffortUpdater.update()
} else {
bestEffortLock.unlock()
}
machine.updateView(forPixelSize: view.backingSize)
fallthrough
case .appKit:
self.machine.drawView(forPixelSize: view.backingSize)
case .appKit:
machine.drawView(forPixelSize: view.backingSize)
}
}
}