Skip to content

Fix Search & Replace deadlock#258

Merged
lhecker merged 1 commit intomainfrom
users/lhecker/58-search-deadlock
May 25, 2025
Merged

Fix Search & Replace deadlock#258
lhecker merged 1 commit intomainfrom
users/lhecker/58-search-deadlock

Conversation

@lhecker
Copy link
Member

@lhecker lhecker commented May 24, 2025

Closes #57
Closes #58

unsafe { (f.uregex_setUText)(self.0, text.0 as *const _ as *mut _, &mut status) };
// `uregex_setUText` resets the regex to the start of the text.
// Because of this, we must also call `uregex_reset64`.
unsafe { (f.uregex_reset64)(self.0, offset as i64, &mut status) };
Copy link
Member

Choose a reason for hiding this comment

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

Does setting the offset to the start of the match cause us to deadlock if you Find "a" replace with "a"? Do we need somehow to skip the matched section?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case the caller specifies the "current offset" which is past the replaced range.

@lhecker lhecker merged commit 54c4721 into main May 25, 2025
1 check passed
@lhecker lhecker deleted the users/lhecker/58-search-deadlock branch May 25, 2025 10:08
diabloproject pushed a commit to diabloproject/edit that referenced this pull request May 29, 2025
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.

Deadlock during Search and Replace Search and replace is broken

2 participants