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

[SuperEditor] Fix immutability violation in spellchecking styler (Resolves #2560) #2568

Merged

Conversation

angelosilvestre
Copy link
Collaborator

[SuperEditor] Fix immutability violation in spellchecking styler (Resolves #2560)

A crash was reported within spelling_and_grammar.dart within _applyErrors() where we try to do the following:

viewModel.grammarErrors
  ..clear()
  ..addAll([
    //....
  ]);

I didn't find any places where we return an unmodifiable list from the the grammarErrors, but I think it's safer to replace the list instead of modifying it, because apps can add custom view models, that might return an unmodifiable list for grammarErrors.

This PR changes the SpellingAndGrammarStyler to override the viewmodel's spellingErrors and grammarErrors.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matthew-carroll matthew-carroll merged commit 3f504da into main Feb 7, 2025
14 of 16 checks passed
@matthew-carroll matthew-carroll deleted the 2560_fix-immutability-violation-in-spellcheck branch February 7, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spellcheck][Bug] - Immutability violation
2 participants