From 641f26e13e2faaf443dbae5b25c1fb5e362738f5 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 25 Feb 2022 14:29:21 +0200 Subject: [PATCH] Fix serial close behavior --- Cocoa/Document.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Cocoa/Document.m b/Cocoa/Document.m index 8f02f86..0f9f525 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -453,7 +453,6 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) - (void) run { assert(!master); - running = true; [self preRun]; if (slave) { [slave preRun]; @@ -532,6 +531,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) return; } if (running) return; + running = true; [[[NSThread alloc] initWithTarget:self selector:@selector(run) object:nil] start]; } @@ -2065,6 +2065,7 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) bool wasRunning = self->running; Document *partner = master ?: slave; if (partner) { + wasRunning |= partner->running; [self stop]; partner->master = nil; partner->slave = nil;