Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318463 - Project Description is loaded although using flag GET_IF_LOADDED
Summary: Project Description is loaded although using flag GET_IF_LOADDED
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 310795
  Show dependency tree
 
Reported: 2010-06-30 09:16 EDT by Markus Schorn CLA
Modified: 2010-07-02 04:23 EDT (History)
1 user (show)

See Also:


Attachments
fix (993 bytes, patch)
2010-07-01 10:21 EDT, Markus Schorn CLA
mschorn.eclipse: iplog-
mschorn.eclipse: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Schorn CLA 2010-06-30 09:16:27 EDT
When calling CProjectDescriptionManager.getInstance().getProjectDescription(p, GET_IF_LOADDED) the description is actually loaded. 

The following line in XmlProjectDescriptionStorage cause this behavior (when
the project description has not been loaded 'checkExternalModification' returns
true):

   // If the description is already loaded and has been modified...
   load |= checkExternalModification();
Comment 1 James Blackburn CLA 2010-06-30 10:01:11 EDT
Interesting find.

This prompts the question: what should we do if the caller has GET_IF_LOADED but the read-only description cache is out of date w.r.t. the backing store?
Comment 2 Markus Schorn CLA 2010-07-01 08:56:43 EDT
(In reply to comment #1)
> Interesting find.
> 
> This prompts the question: what should we do if the caller has GET_IF_LOADED
> but the read-only description cache is out of date w.r.t. the backing store?

Tough question, I'd say it should not load the description. The reason why one would use GET_IF_LOADED is to make a quick check whether there is a project description available ready for use. 

For my specific use case it would also work if it gets loaded in that case.
Comment 3 Markus Schorn CLA 2010-07-01 10:21:49 EDT
Created attachment 173219 [details]
fix
Comment 4 James Blackburn CLA 2010-07-01 10:25:36 EDT
Looks good to me.  
checkExternalModification() explicitly invalidates the read-only desc.  This change will ensure the description is only reloaded if the API caller wants it to be.
Comment 5 Markus Schorn CLA 2010-07-02 03:35:47 EDT
Fixed in 8.0 > 20100702.
Comment 6 CDT Genie CLA 2010-07-02 04:23:05 EDT
*** cdt cvs genie on behalf of mschorn ***
Bug 318463:  Project Description is loaded although using flag GET_IF_LOADDED

[*] XmlProjectDescriptionStorage.java 1.9 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/settings/model/xml/XmlProjectDescriptionStorage.java?root=Tools_Project&r1=1.8&r2=1.9