From 350b8a90248531431c55b79a2ba9fb19b652b4f2 Mon Sep 17 00:00:00 2001 From: Pepe Rivera Date: Wed, 22 Jan 2020 13:39:51 -0800 Subject: [PATCH] Fix graphing crash when plotting equations with errors (#958) * fix crash * Fix follow up crash * real fix --- src/GraphControl/Control/Grapher.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/GraphControl/Control/Grapher.cpp b/src/GraphControl/Control/Grapher.cpp index 2901de7..d548bee 100644 --- a/src/GraphControl/Control/Grapher.cpp +++ b/src/GraphControl/Control/Grapher.cpp @@ -162,14 +162,11 @@ namespace GraphControl void Grapher::OnEquationChanged(Equation ^ equation) { - // If the equation was previously valid, we should try to graph again in the event of the failure - bool shouldRetry = equation->IsValidated; - // Reset these properties if the equation is requesting to be graphed again equation->HasGraphError = false; equation->IsValidated = false; - TryPlotGraph(false, shouldRetry); + TryPlotGraph(false, true); } void Grapher::OnEquationStyleChanged(Equation ^) @@ -321,7 +318,7 @@ namespace GraphControl // Do not re-initialize the graph to empty if there are still valid equations graphed if (!shouldKeepPreviousGraph) { - initResult = TryInitializeGraph(keepCurrentView, graphExpression.get()); + initResult = m_graph->TryInitialize(); if (initResult != nullopt) { UpdateGraphOptions(m_graph->GetOptions(), validEqs);