From a42c2dda5b1ffaef425db0c3337678a386ff4be8 Mon Sep 17 00:00:00 2001 From: Chaiwat Ekkaewnumchai Date: Tue, 19 May 2020 09:41:15 -0700 Subject: [PATCH] Fix Highlight not Removed Properly When Quit Flipper via Shortcut Summary: Discovered in https://fburl.com/h6eczhr2; the highlight didn't get removed correctly. This was from [this method](https://fburl.com/diffusion/twur28gt), which must be called on main thread to be executed completely. Reviewed By: jknoxville Differential Revision: D21629318 fbshipit-source-id: cfc52ac755a1ddfe92e675aac1a81066ce338bd7 --- .../FlipperKitLayoutPlugin.mm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.mm b/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.mm index cc6c23187..42b8bfe6b 100644 --- a/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.mm +++ b/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.mm @@ -164,10 +164,15 @@ } - (void)didDisconnect { - // Clear the last highlight if there is any - [self onCallSetHighlighted:nil withResponder:nil]; - // Disable search if it is active - [self onCallSetSearchActive:NO withConnection:nil]; + // removeFromSuperlayer (SKHighlightOverlay) needs to be called on main thread + FlipperPerformBlockOnMainThread( + ^{ + // Clear the last highlight if there is any + [self onCallSetHighlighted:nil withResponder:nil]; + // Disable search if it is active + [self onCallSetSearchActive:NO withConnection:nil]; + }, + nil); } - (void)onCallGetRoot:(id)responder {