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

ProjectManager.getAllFiles() doesn't usually honor includeWorkingSet=false (the supposed default) #8930

Open
peterflynn opened this issue Sep 2, 2014 · 3 comments

Comments

@peterflynn
Copy link
Member

Invoking ProjectManager.getAllFiles() (or more explicitly, ProjectManager.getAllFiles(null, false)) often yields an array that includes files outside the project that are open in the working set. This happens any time someone has called ProjectManager.getAllFiles(true) earlier.

Most callers supposedly don't want working-set entries that are outside the project -- only Find in Files & Quick Open pass true. But since this bug has existed seemingly since Sprint 36 (a7a551d), those callers have been getting project-external items in the result list anyway. So presumably this doesn't cause any major ill effects for most callers.

This happens because getAllFiles() reuses a cached result, and when includeWorkingSet is true it modifies the cache in-place to include the extra files. It should make a copy instead to prevent tainting the cache used by future callers.

@dangoor dangoor self-assigned this Sep 3, 2014
@dangoor
Copy link
Contributor

dangoor commented Sep 3, 2014

Assigning to myself because I may have already fixed this in the project manager work...

@pthiess pthiess mentioned this issue Sep 3, 2014
30 tasks
@dangoor dangoor added this to the Release 0.44 milestone Sep 9, 2014
@peterflynn
Copy link
Member Author

Fwiw, looks like it's not fixed yet, since ProjectModel.getAllFiles() directly modifies the result array that _getAllFilesCache() hands back, affecting the value all future calls will see.

@dangoor
Copy link
Contributor

dangoor commented Oct 5, 2014

Yeah, this is still on my list. Should be a trivial fix (just add a _.clone).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants