Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318463

Summary: Project Description is loaded although using flag GET_IF_LOADDED
Product: [Tools] CDT Reporter: Markus Schorn <mschorn.eclipse>
Component: cdt-coreAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Doug Schaefer <cdtdoug>
Severity: normal    
Priority: P3 CC: jamesblackburn+eclipse
Version: 7.0   
Target Milestone: 8.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 310795    
Attachments:
Description Flags
fix mschorn.eclipse: iplog-, mschorn.eclipse: review?

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