Fix deadlock in SetText#665
Merged
rivo merged 1 commit intorivo:masterfrom Oct 29, 2021
SamWhited:fix_crash
Merged
Conversation
Signed-off-by: Sam Whited <sam@samwhited.com>
Owner
|
Good catch. Regarding tests, if you plan on adding tests to this package, you should expect significant reviewing & refactoring work before it's merged. In the past, people have tried to throw in test cases here and there without much structure. I didn't merge them, not because I don't like tests (on the contrary!), but because I just didn't want to have a messy codebase to maintain. If you haven't seen it yet, you may want to tread this comment: #572 (comment). This is where I would start. If you have ideas about this, you might want to open an issue for some discussion before diving into the code. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I realized right as I saw the email that the batch stuff had been merged that my change to the locking in SetText would obviously cause a deadlock (we aquire the lock, then the Write method is called which also tries to aquire the lock).
If you'd permit me, I'd like to write tests for some of the functions in this library, it could have prevented this being merged in the first place if I'd written some tests about it. While you consider it though I've pushed up this fix quickly that at least lets SetText be usable again.