From 0fc8152a04265b07afa51c246dd8058ae41da20f Mon Sep 17 00:00:00 2001 From: David Maas Date: Fri, 10 May 2024 20:59:20 -0500 Subject: [PATCH] Fix race condition within `HandleWorkflowError` Also adds a more sensible caption to the error dialog when non-workflow errors occur. --- Bonsai.Editor/EditorForm.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Bonsai.Editor/EditorForm.cs b/Bonsai.Editor/EditorForm.cs index bf12a9e4..573c6642 100644 --- a/Bonsai.Editor/EditorForm.cs +++ b/Bonsai.Editor/EditorForm.cs @@ -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; @@ -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);