Skip to content

Conversation

@migueldeicaza
Copy link
Contributor

The parse method in TreeSitterInternalLanguageMode is invoked directly by the
TextInputView.string.setter method, which can happen concurrently with the
calls to parse(_ text: NSString, completion: @escaping ((Bool) -> Void)) which happen to
queue things into a dedicated thread.

This causes a double-free of the underlying structures and assorted other crashes.

I caught this using the "address sanitizer" as I was trying to use my SwiftUI wrapper for
Runestone, which would trigger this event.

… parse and this parse happen at the same time
@migueldeicaza migueldeicaza requested a review from simonbs as a code owner April 5, 2024 02:40
@simonbs
Copy link
Owner

simonbs commented Apr 6, 2024

Thanks a ton! I’ve been postponing fixing this for waaaay too long. It didn’t occur to me that that issue could be addressed this simply/elegantly 😄

Copy link
Contributor Author

@migueldeicaza migueldeicaza left a comment

Choose a reason for hiding this comment

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

Looks fine to me.

@simonbs simonbs merged commit 36d91bf into simonbs:main Apr 15, 2024
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.

2 participants