Lock m_renderMain in Grapher::TryInitializeGraph to avoid modifying m_graph during rendering (#1430)

This commit is contained in:
Hongxu Xu 2020-11-12 01:40:39 +08:00 committed by GitHub
parent 483dacbeff
commit 296cf038b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1085,7 +1085,6 @@ void Grapher::OnGraphBackgroundPropertyChanged(Windows::UI::Color /*oldValue*/,
} }
} }
void Grapher::OnGridLinesColorPropertyChanged(Windows::UI::Color /*oldValue*/, Windows::UI::Color newValue) void Grapher::OnGridLinesColorPropertyChanged(Windows::UI::Color /*oldValue*/, Windows::UI::Color newValue)
{ {
if (m_renderMain != nullptr && m_graph != nullptr) if (m_renderMain != nullptr && m_graph != nullptr)
@ -1113,6 +1112,7 @@ void Grapher::OnLineWidthPropertyChanged(double oldValue, double newValue)
optional<vector<shared_ptr<Graphing::IEquation>>> Grapher::TryInitializeGraph(bool keepCurrentView, const IExpression* graphingExp) optional<vector<shared_ptr<Graphing::IEquation>>> Grapher::TryInitializeGraph(bool keepCurrentView, const IExpression* graphingExp)
{ {
critical_section::scoped_lock lock(m_renderMain->GetCriticalSection());
if (keepCurrentView || IsKeepCurrentView) if (keepCurrentView || IsKeepCurrentView)
{ {
auto renderer = m_graph->GetRenderer(); auto renderer = m_graph->GetRenderer();