-
Notifications
You must be signed in to change notification settings - Fork 168
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 a segfault in code produced by Visual Studio 2019 #4825
Conversation
Should this revert #4749 and fix it in a similar way? |
@nirinchev yes good point, I would rather have verbose code like this and reenable the runtime checks in debug mode - in case there is another bug lurking there as well. However, I will wait for one reviewer to approve the initial fix before propagating it elsewhere. |
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 like the more explicit approach.
I removed the |
}, | ||
[&](Obj&, ColKey) { | ||
bad_transaction_log("Invalid path for ArrayInsert (obj, col)"); | ||
}}; | ||
|
||
resolve_path(instr, "ArrayInsert", callback); |
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.
Why don't we use std::move(callback)
here.
}, | ||
}; | ||
resolve_path(instr, "ArrayErase", callback); | ||
resolve_path( |
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 use the same pattern everywhere. Any particular reason not to have a callback
variable here?
}; | ||
|
||
resolve_path(instr, "Clear", callback); | ||
resolve_path(instr, "Clear", |
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.
Same as above
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.
This was the only case where VS 2019 actually didn't work with std::move, and I've added a comment about it and changed the rest to be consistent.
}, | ||
[&](Obj&, ColKey) { | ||
bad_transaction_log("Invalid path for SetErase (object, column)"); | ||
}}; | ||
|
||
resolve_path(instr, "SetErase", callback); |
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.
std::move
?
The segfault was discovered by additional tests enabled in #4706.
It looks to have been introduced by #4178 to fix another MSVC issue in debug mode. Instead of reverting that change which would bring up the old debug mode issue, this changes the code to not rely on the
mpark::visit(overload
pattern with an auto case as this seems to be a combination of code that shows a bug in MSVC 2019 and/or mpark.I have observed that there are other ways to "fix" the issue, such as removing the lifetime extension idea and adding an explicit case for GlobalKey:
But the changes in this PR seem less magical and less prone to similar issues in the future.
This should also fix #4624
☑️ ToDos