/// <summary> /// Starts the process of closing the project file editor, if one is open currently. /// </summary> public async Task CloseCurrentEditorAsync() { lock (_lock) { if (_currentState == EditorState.NoEditor) { return; } // Checking for potential dirty state and asking if the user wants to save their changes will have already occurred at this point. // Just go to EditorClosing. _currentState = EditorState.EditorClosing; } _projectFileModelWatcher?.Dispose(); _textBufferStateListener?.Dispose(); if (_frameEventsListener != null) { await _frameEventsListener.DisposeAsync().ConfigureAwait(false); } _textBufferManager?.Dispose(); _projectFileModelWatcher = null; _frameEventsListener = null; _textBufferStateListener = null; _textBufferManager = null; lock (_lock) { _currentState = EditorState.NoEditor; } return; }