| Summary: | CModelManager.getSharedWorkingCopy() always create a new WorkingCopy | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Vivian Kong <vivkong> |
| Component: | cdt-editor | Assignee: | Vivian Kong <vivkong> |
| Status: | RESOLVED FIXED | QA Contact: | Anton Leherbauer <aleherb+eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, mschorn.eclipse |
| Version: | 7.0 | Flags: | cdtdoug:
review+
|
| Target Milestone: | 7.0 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Fixed in HEAD Looks good. I'm not sure why this didn't produce a compile error with the templated Map. *** cdt cvs genie on behalf of vkong *** Bug 315810 CModelManager.getSharedWorkingCopy() always create a new WorkingCopy [*] CModelManager.java 1.139 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java?root=Tools_Project&r1=1.138&r2=1.139 |
I think this was missed when the method was moved from TranslationUnit. I'd like to have this change in CDT 7.0. Here's my proposed patch (1 line change): ### Eclipse Workspace Patch 1.0 #P org.eclipse.cdt.core Index: model/org/eclipse/cdt/internal/core/model/CModelManager.java =================================================================== RCS file: /cvsroot/tools/org.eclipse.cdt/all/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java,v retrieving revision 1.138 diff -u -r1.138 CModelManager.java --- model/org/eclipse/cdt/internal/core/model/CModelManager.java 20 Feb 2010 10:51:38 -0000 1.138 +++ model/org/eclipse/cdt/internal/core/model/CModelManager.java 4 Jun 2010 17:51:55 -0000 @@ -1374,7 +1374,7 @@ perFactoryWorkingCopies = new HashMap<ITranslationUnit, WorkingCopy>(); sharedWorkingCopies.put(factory, perFactoryWorkingCopies); } - WorkingCopy workingCopy = perFactoryWorkingCopies.get(this); + WorkingCopy workingCopy = perFactoryWorkingCopies.get(tu); if (workingCopy != null) { workingCopy.useCount++; return workingCopy;