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

Lock m_renderMain in Grapher::TryInitializeGraph to avoid race condition #1430

Merged
merged 1 commit into from
Nov 11, 2020

Conversation

xuhongxu96
Copy link
Contributor

@xuhongxu96 xuhongxu96 commented Nov 11, 2020

Fixes #1293 .

The Calculator crashes when removing an expression with another expression just cleared.
This behavior will trigger the graph updating twice in a short time, which leads to a potential race condition to m_graph.
The app crashes because one thread is rendering the m_graph and another tries to initialize the m_graph.

Description of the changes:

  • Add lock to m_renderMain->GetCriticalSection() in Grapher::TryInitializeGraph
  • Minor improvements to code style

How changes were validated:

As Graph is not included in the community version, tests cannot be added.

Copy link
Contributor

@EriWong EriWong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, and buddy testing does show the issue is resolved. Thanks for fixing this!

@EriWong EriWong merged commit 296cf03 into microsoft:master Nov 11, 2020
@xuhongxu96 xuhongxu96 deleted the hox/fix-1293 branch November 12, 2020 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Graphing - remove equation crashes app
2 participants