Skip to content

Commit ac8275f

Browse files
[Cherry-pick] DYN-10383: Fix SplashScreen close re-entrancy crash in LaunchDynamo (#17041)
1 parent 7ba353a commit ac8275f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,16 @@ private void LaunchDynamo(bool isCheckboxChecked)
331331
viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked;
332332
}
333333
currentCloseMode = CloseMode.ByStartingDynamo;
334-
Close();
334+
335335
dynamoView?.Show();
336336
dynamoView?.Activate();
337+
338+
// Defer closing the splash screen until the dispatcher is idle.
339+
// This method is invoked from a WebView2 JS-to-.NET callback, so calling Close()
340+
// synchronously can trigger webView.Dispose() while still inside that callback,
341+
// causing re-entrancy crashes. Showing dynamoView first ensures WPF always has a
342+
// visible window, preventing ShutdownMode.OnLastWindowClose from terminating the app.
343+
Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, () => Close());
337344
}
338345

339346
private void OnLoginStateChanged(LoginState state)

0 commit comments

Comments
 (0)