Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't null out WorkspaceRegistration in Dispose() #49048

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ internal partial class SuggestedActionsSourceProvider
private class SuggestedActionsSource : ForegroundThreadAffinitizedObject, ISuggestedActionsSource3
{
private readonly ISuggestedActionCategoryRegistryService _suggestedActionCategoryRegistry;
private readonly WorkspaceRegistration _registration;

// state that will be only reset when source is disposed.
private SuggestedActionsSourceProvider _owner;
private ITextView _textView;
private ITextBuffer _subjectBuffer;
private WorkspaceRegistration _registration;

// mutable state
private Workspace? _workspace;
Expand Down Expand Up @@ -89,10 +89,7 @@ public void Dispose()
_workspace.DocumentActiveContextChanged -= OnActiveContextChanged;
}

if (_registration != null)
{
_registration.WorkspaceChanged -= OnWorkspaceChanged;
}
_registration.WorkspaceChanged -= OnWorkspaceChanged;

if (_textView != null)
{
Expand All @@ -102,7 +99,6 @@ public void Dispose()
_owner = null!;
_workspace = null;
_workspaceStatusService = null;
_registration = null!;
_textView = null!;
_subjectBuffer = null!;
}
Expand Down