Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

working set files are not guaranteed to be openable, so check for failure #1564

Merged
merged 1 commit into from
Sep 6, 2012

Conversation

redmunds
Copy link
Contributor

@redmunds redmunds commented Sep 5, 2012

This is for issues #1543 and #1544

@ghost ghost assigned peterflynn Sep 6, 2012
@peterflynn
Copy link
Member

Reviewing

// File chosen to be switched to could not be opened, and the original file
// is still in editor. Close it again so code will try to open the next file,
// or empty the editor if there are no other files.
closeFullEditor(file);
Copy link
Member

Choose a reason for hiding this comment

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

What if we change DocumentCommandHandlers.doOpen() to call DocumentManager.notifyFileDeleted() instead of calling removeFromWorkingSet() as it does today? Then this fail() block would be unneeded (since notifyFileDeleted() calls closeFullEditor()).

That would also get us halfway to fixing #1451 in the bargain...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That change doesn't work if I remove the fail() block code, but it does work if I leave the fail() block code in.

I'm not sure if I agree with #1451, so I'll add my comment there.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I see -- my suggestion isn't sufficient because closeFullEditor() is relying on FILE_OPEN (of the no-longer-existing file) to switch away from the closed file's editor. FILE_OPEN notifying that the next file was deleted doesn't substitute for that, since notifyFileDeleted() only touches the editor if the deleted file was open in the editor. It has no idea about the pending close operation that wants to get rid of some other editor.

I still believe #1451 is a change we should make, but it indeed doesn't help with anything here. Sorry for the confusion.

@peterflynn
Copy link
Member

Done reviewing

@peterflynn
Copy link
Member

With that question resolved, I think this is good to merge as-is

peterflynn added a commit that referenced this pull request Sep 6, 2012
Fix bugs #1543 and #1544: working set files are not guaranteed to be openable, so check for failure; defer assertion until it's (supposed to be) guaranteed to be valid
@peterflynn peterflynn merged commit ee9f52f into master Sep 6, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants