1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for PR 58481

This commit is contained in:
Alain Magloire 2004-04-16 00:35:42 +00:00
parent ff65631c31
commit 3f68cfad81
4 changed files with 46 additions and 17 deletions

View file

@ -1,3 +1,18 @@
2004-04-15 Alain Magloire
Fix for PR 58481
Since TypeInfo shares have some common code
with the Search the fix was put in the search to.
The fix is to check the accessibility of the project
before introspecting it, it may have been deleted.
* browser/org/eclipse/cdt/internal/core/browser/cache/TypeMatchLocator.java
* search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java
Remove the synchronized it is not necessary and causes
deadlocks.
* model/org/eclipse/cdt/internal/core/model/Openable.java
2004-04-14 Alain Magloire 2004-04-14 Alain Magloire
This is temporary 'till we get the fancy ICType scheme This is temporary 'till we get the fancy ICType scheme

View file

@ -432,14 +432,22 @@ public class TypeMatchLocator implements ISourceElementRequestor, ICSearchConsta
workingCopy= (IWorkingCopy) workingCopyMap.get(path); workingCopy= (IWorkingCopy) workingCopyMap.get(path);
if (workingCopy != null) { if (workingCopy != null) {
currentResource= workingCopy.getResource(); currentResource= workingCopy.getResource();
reader= new CharArrayReader(workingCopy.getContents()); if (currentResource != null && currentResource.isAccessible()) {
reader= new CharArrayReader(workingCopy.getContents());
} else {
continue;
}
} else { } else {
currentResource= workspaceRoot.findMember(path, true); currentResource= workspaceRoot.findMember(path, true);
if (currentResource != null && currentResource instanceof IFile) { if (currentResource != null) {
IFile file= (IFile) currentResource; if (currentResource.isAccessible() && currentResource instanceof IFile) {
try { IFile file= (IFile) currentResource;
reader= new InputStreamReader(file.getContents()); try {
} catch (CoreException ex) { reader= new InputStreamReader(file.getContents());
} catch (CoreException ex) {
continue;
}
} else {
continue; continue;
} }
} }

View file

@ -198,9 +198,7 @@ public abstract class Openable extends Parent implements IOpenable, IBufferChang
* @see org.eclipse.cdt.core.model.IOpenable#isOpen() * @see org.eclipse.cdt.core.model.IOpenable#isOpen()
*/ */
public boolean isOpen() { public boolean isOpen() {
synchronized(CModelManager.getDefault()){ return CModelManager.getDefault().getInfo(this) != null;
return CModelManager.getDefault().getInfo(this) != null;
}
} }
/** /**

View file

@ -397,19 +397,27 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
IWorkingCopy workingCopy = (IWorkingCopy)wcPaths.get( pathString ); IWorkingCopy workingCopy = (IWorkingCopy)wcPaths.get( pathString );
if( workingCopy != null ){ if( workingCopy != null ){
reader = new CharArrayReader( workingCopy.getContents() );
currentResource = workingCopy.getResource(); currentResource = workingCopy.getResource();
realPath = currentResource.getLocation(); if ( currentResource != null && currentResource.isAccessible() ) {
project = currentResource.getProject(); reader = new CharArrayReader( workingCopy.getContents() );
realPath = currentResource.getLocation();
project = currentResource.getProject();
} else {
continue;
}
} else { } else {
currentResource = workspaceRoot.findMember( pathString, true ); currentResource = workspaceRoot.findMember( pathString, true );
try{ try{
if( currentResource != null && currentResource instanceof IFile ){ if( currentResource != null ){
IFile file = (IFile) currentResource; if (currentResource.isAccessible() && currentResource instanceof IFile) {
reader = new InputStreamReader( file.getContents() ); IFile file = (IFile) currentResource;
realPath = currentResource.getLocation(); reader = new InputStreamReader( file.getContents() );
project = file.getProject(); realPath = currentResource.getLocation();
project = file.getProject();
} else {
continue;
}
} }
} catch ( CoreException e ){ } catch ( CoreException e ){
continue; continue;