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

Fix TextEdit/CodeEdit crash with invalid caret position. #81331

Closed
wants to merge 1 commit into from

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Sep 5, 2023

Fixes #73202

@bruvzg bruvzg added this to the 4.2 milestone Sep 5, 2023
@bruvzg bruvzg requested a review from a team as a code owner September 5, 2023 08:01
@YuriSizov YuriSizov requested a review from Paulb23 September 5, 2023 14:34
Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

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

This feels like a patch over the real issue, where the caret is given an invalid position after undoing.

@@ -623,7 +623,7 @@ void TextEdit::_notification(int p_what) {
}
}

if (get_caret_column(caret) > 0) {
if (get_caret_column(caret) > 0 && get_caret_column(caret) <= text[get_caret_line(caret)].length()) {
Copy link
Member

Choose a reason for hiding this comment

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

If @Paulb23 doesn't like that approach, maybe we can make this an ERR_FAIL_COND instead, so it still fixes the crash but points that there's something fishy?

@akien-mga akien-mga modified the milestones: 4.2, 4.3 Oct 26, 2023
@akien-mga akien-mga added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Oct 26, 2023
@akien-mga
Copy link
Member

Superseded by #86978.

@akien-mga akien-mga closed this Apr 30, 2024
@akien-mga akien-mga added archived and removed cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Apr 30, 2024
@akien-mga akien-mga removed this from the 4.3 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Executing CodeEdit functions crashes Godot
3 participants