From f667514d32c27ebf51af734442367b9cc41f60b3 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Fri, 24 Oct 2014 11:46:16 +0200 Subject: [PATCH] Update the debug window on the main thread. --- Classes/SBDebugLogController.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Classes/SBDebugLogController.m b/Classes/SBDebugLogController.m index 465d5d2..e2050c8 100644 --- a/Classes/SBDebugLogController.m +++ b/Classes/SBDebugLogController.m @@ -32,9 +32,11 @@ } - (void)log:(NSString *)string { - NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string]; - [[self.logView textStorage] appendAttributedString:attributedString]; - [attributedString release]; + dispatch_async(dispatch_get_main_queue(), ^{ + NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:string]; + [[self.logView textStorage] appendAttributedString:attributedString]; + [attributedString release]; + }); } - (IBAction)clearLog:(id)sender {