From bc60ca017474a5ea7908a2258aef223d8b08eac1 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Mon, 27 Aug 2018 12:12:39 +0200 Subject: [PATCH] moving autotype execution to main thread --- MacPass/MPAutotypeDaemon.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MacPass/MPAutotypeDaemon.m b/MacPass/MPAutotypeDaemon.m index b51f1744..eb7623df 100644 --- a/MacPass/MPAutotypeDaemon.m +++ b/MacPass/MPAutotypeDaemon.m @@ -242,11 +242,13 @@ static MPAutotypeDaemon *_sharedInstance; /* TODO - we can use a saver way and use a notification to check if the app actally was activated */ usleep(1 * NSEC_PER_MSEC); } - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - for(MPAutotypeCommand *command in [MPAutotypeCommand commandsForContext:context]) { + + for(MPAutotypeCommand *command in [MPAutotypeCommand commandsForContext:context]) { + /* dispatch commands to main thread since most of them translate key events which is disallowed on background thread */ + dispatch_async(dispatch_get_main_queue(), ^{ [command execute]; - } - }); + }); + } } #pragma mark -