-
Notifications
You must be signed in to change notification settings - Fork 614
Fix for 13839: Crash on opening file with error "sharing violation". #635
Conversation
…seems better than the newer approach. Also this will resolve the crash on opening a file that is being exclusively held by other process.
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.
LGTM. That invalid handle check is what makes the class approach look odd.
Apologies for the late response. Just saw the PR I am not sure how this PR fixes the issue discussed. |
@saurabh95 No issues Saurabh! Thanks for looking at the PR! There are fundamental problems with the class that was introduced which had to take care of getting a valid file handle.
I checked for any other exception scenarios and figured out that most of the code is anyways wrapped inside |
Thanks @swmitra ! |
@nethip Yeah it makes sense when we have So ideally, if we wrap the So, I am not able to get how this actually solves the problem or not. Also, it seems that @devdmore faced this issue recently while this code has been there for a while now. Can we do a pre-release and share it with @devdmore so that we can be sure that the issue is resolved? |
@saurabh95 We are able to repro this bug 100%, and with the older approach the crash seems to be resolved. We already have a pre-release planned in the coming weeks. So we could surely invite users to try out the build and see if they face any issues. Regarding the actual fix: If the approaches are same, then I would recommend sticking to the earlier format especially because of the problems I have sited in the comment above and also because of the testing impact. If older code, is tried and tested and is working for a long time, I would rather go with the older approach than the newer one, unless you there is a strong reason for doing it. About error handling, we are already handling the error cases by returning, if the handle is invalid. In So if you still feel that having a new class is the way to go, please feel free to raise a PR with your recommended changes. We would review it. Please follow the below guidelines.
|
@nethip, I totally agree with you, the current approach (non-RAII) is better, and there were definitely some mistakes(which you pointed out) in the RAII approach. And also the error handling in non-RAII approach is better as you mentioned. |
Reverting the file opening to the older format as the older approach seems better than the newer approach. Also this will resolve the crash on opening a file which is being exclusively held by another process.
Fixes adobe/brackets#13839
@saurabh95 Will you be able to review this?