shut down JSC before quitting its thread

Differential Revision: D3280544

fbshipit-source-id: 2a3ef2c445aaa1b224ac391b020467e087c0b81d
This commit is contained in:
Marc Horowitz 2016-05-18 12:46:05 -07:00 committed by Facebook Github Bot 5
parent 779314a413
commit 6796f136f1
1 changed files with 5 additions and 5 deletions

View File

@ -303,13 +303,13 @@ ExecutorToken NativeToJsBridge::getTokenForExecutor(JSExecutor& executor) {
void NativeToJsBridge::destroy() {
m_delegate->quitQueueSynchronous();
auto executorMessageQueueThread = getMessageQueueThread(m_mainExecutorToken);
executorMessageQueueThread->runOnQueueSync([this, &executorMessageQueueThread] {
auto* executorMessageQueueThread = getMessageQueueThread(m_mainExecutorToken);
executorMessageQueueThread->runOnQueueSync([this, executorMessageQueueThread] {
m_mainExecutor->destroy();
executorMessageQueueThread->quitSynchronous();
*m_destroyed = true;
std::unique_ptr<JSExecutor> mainExecutor = unregisterExecutor(*m_mainExecutor);
unregisterExecutor(*m_mainExecutor);
m_mainExecutor = nullptr;
mainExecutor->destroy();
*m_destroyed = true;
});
}