From bd3f9763f78cca6a3d6f11e57f45f4b428d76ba9 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Tue, 23 Jun 2015 08:17:29 -0100 Subject: [PATCH] [ReactNative] Fix alert out of main thread Summary: @public I've added an alert to notify when the profile has been generated, but it was being created out of the main thread. Test Plan: Launch the UIExplorer, start and stop profiling, an alert should show up, and everything should just keep working as expected. --- React/Base/RCTBridge.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index c1b4373c9..e844cd8b1 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -1530,11 +1530,13 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module if (error) { RCTLogError(@"%@", error.localizedDescription); } else { - [[[UIAlertView alloc] initWithTitle:@"Profile" - message:@"The profile has been generated, check the dev server log for instructions." - delegate:nil - cancelButtonTitle:@"OK" - otherButtonTitles:nil] show]; + dispatch_async(dispatch_get_main_queue(), ^{ + [[[UIAlertView alloc] initWithTitle:@"Profile" + message:@"The profile has been generated, check the dev server log for instructions." + delegate:nil + cancelButtonTitle:@"OK" + otherButtonTitles:nil] show]; + }); } }];