Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require AttachRoot to be called from UI thread #2551

Merged
merged 1 commit into from
Jun 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions vnext/ReactUWP/Views/ReactControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,15 @@ void ReactControl::AttachRoot() noexcept
});
});

// Schedule initialization that must happen on the UI thread
m_reactInstance->DefaultNativeMessageQueueThread()->runOnQueue([this]() {
m_touchEventHandler->AddTouchHandlers(m_xamlRootView);
auto initialProps = m_initialProps;
m_reactInstance->AttachMeasuredRootView(m_pParent, std::move(initialProps));
});
// We assume Attach has been called from the UI thread
#ifdef DEBUG
auto coreWindow = winrt::CoreWindow::GetForCurrentThread();
assert(coreWindow != nullptr);
#endif

m_touchEventHandler->AddTouchHandlers(m_xamlRootView);
auto initialProps = m_initialProps;
m_reactInstance->AttachMeasuredRootView(m_pParent, std::move(initialProps));

m_isAttached = true;
}
Expand Down