Skip to content

Commit

Permalink
Fix race condition within HandleWorkflowError
Browse files Browse the repository at this point in the history
Also adds a more sensible caption to the error dialog when non-workflow errors occur.
  • Loading branch information
PathogenDavid committed May 11, 2024
1 parent 88a2412 commit 0fc8152
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Bonsai.Editor/EditorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,7 @@ bool HandleSchedulerError(Exception e)

void HandleWorkflowError(Exception e)
{
var building = this.building; // Ensure the current value of `building` is used when if the handler below is invoked
Action selectExceptionNode = () =>
{
var workflowException = e as WorkflowException;
Expand All @@ -1415,7 +1416,7 @@ void HandleWorkflowError(Exception e)
workflowError = workflowException;
HighlightExceptionBuilderNode(workflowException, building);
}
else editorSite.ShowError(e.Message, Name);
else editorSite.ShowError(e.Message, "Internal workflow error");
};

if (InvokeRequired) BeginInvoke(selectExceptionNode);
Expand Down

0 comments on commit 0fc8152

Please sign in to comment.