[ReactNative] Fix RCTBatchedBridge main thread invalidation

Summary:
D2052669 introduced a block for objects that had to be invalidated on the main
thread, but after the JS thread objects, but the block was being dispatched on
the JS thread.

@public

Test Plan:
I added `RCTAssertMainThread()` to the `mainThreadInvalidate` block, it was
crashing on reload, but now it should work as expected.
This commit is contained in:
Tadeu Zagallo 2015-05-17 18:32:00 -07:00
parent 407d8d4cf6
commit a4e89d71a3
1 changed files with 2 additions and 1 deletions

View File

@ -1182,6 +1182,7 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(NSString *)module method:(NSStrin
}
void (^mainThreadInvalidate)(void) = ^{
RCTAssertMainThread();
[_mainDisplayLink invalidate];
_mainDisplayLink = nil;
@ -1221,7 +1222,7 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(NSString *)module method:(NSStrin
/**
* Main Thread deallocations
*/
mainThreadInvalidate();
dispatch_async(dispatch_get_main_queue(), mainThreadInvalidate);
}];
}