-
Notifications
You must be signed in to change notification settings - Fork 351
[SwiftREPL] Fix a wrong copy-constructor assignment causing crashes. #345
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
Conversation
<rdar://problem/57123561>
|
Thanks to Adrian for helping me finding the root cause of this! |
|
@swift-ci test |
adrian-prantl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, there are a few obvious improvements that we can make while we're here.
Also: Can you = delete the copy constructor now?
| m_swift_ast = target_swift_ast; | ||
| } | ||
| SwiftASTContext *swift_ast = m_swift_ast_sp.get(); | ||
| SwiftASTContext *swift_ast = m_swift_ast; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should get rid of m_swift_ast and only use the local copy, because it's not safe to hold on to the pointer without also holding on to the lock.
| //---------------------------------------------------------------------- | ||
| Status error; | ||
| if (!m_swift_ast_sp) { | ||
| if (!m_swift_ast) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we also need to acquire the scratch context lock. That's very easy if you just call target.GetSwiftScratchContext().
|
@swift-ci test |
|
How do we make sure this keeps working? I know the crash didn't happen in our test environment, but is there a way to check that the setup is correct by looking at some side effect maybe? |
|
Is there a separate pull request for acquiring the lock that I missed? |
|
@fredriss We already have a test for this, but it only reproduces in a particular enviroment. If we end up testing that specific environment, we'll get coverage for free. @adrian-prantl patch coming :) |
rdar://problem/57123561