fix: close live document before automation exit
This commit is contained in:
@@ -316,9 +316,15 @@ internal sealed class FirstLimitedApplyAutomationCoordinator
|
||||
// Do not close a cached automation document and then reuse it. Resolve
|
||||
// the currently-live document only at the final quiescent callback.
|
||||
var active = AcadApplication.DocumentManager.MdiActiveDocument;
|
||||
if (active is null) { AcadApplication.Quit(); return; }
|
||||
transitions.Add("NativeQuitDispatched");
|
||||
active.SendStringToExecute("_.QUIT _N ", true, false, false);
|
||||
if (active is not null)
|
||||
{
|
||||
transitions.Add("ActiveDocumentCloseRequested");
|
||||
active.CloseAndDiscard();
|
||||
}
|
||||
// Application.Quit alone leaves the script host alive. Close the
|
||||
// live document first, then request normal application shutdown.
|
||||
transitions.Add("ApplicationQuitRequested");
|
||||
AcadApplication.Quit();
|
||||
}
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user