From 74abf61a08f22295420bc22ba7f96def69844a90 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 23 Jun 2018 11:50:08 +0300 Subject: [PATCH] Fixed a crash that happened when changing the rewind length in Cocoa --- Cocoa/Document.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Cocoa/Document.m b/Cocoa/Document.m index 3da5c6f..7cb0eea 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -1411,9 +1411,11 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, - (void) updateRewindLength { - if (GB_is_inited(&gb)) { - GB_set_rewind_length(&gb, [[NSUserDefaults standardUserDefaults] integerForKey:@"GBRewindLength"]); - } + [self performAtomicBlock:^{ + if (GB_is_inited(&gb)) { + GB_set_rewind_length(&gb, [[NSUserDefaults standardUserDefaults] integerForKey:@"GBRewindLength"]); + } + }]; } @end