1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Cross-referencing projects cause the debugger to go into a stack overflow exception.

Make sure that there is only one source location for each referenced project.
This commit is contained in:
Mikhail Khodjaiants 2003-03-14 19:10:17 +00:00
parent eb65a10890
commit fa3f6e5e4c
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2003-03-14 Mikhail Khodjaiants
Cross-referencing projects cause the debugger to go into a stack overflow exception.
Make sure that there is only one source location for each referenced project.
* CSourceLocator.java
2003-03-13 Alain Magloire 2003-03-13 Alain Magloire
No longer throw exceptions. No longer throw exceptions.

View file

@ -10,6 +10,7 @@ import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
@ -214,7 +215,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
IProject[] projects = project.getReferencedProjects(); IProject[] projects = project.getReferencedProjects();
for ( int i = 0; i < projects.length; i++ ) for ( int i = 0; i < projects.length; i++ )
{ {
if ( projects[i].exists() ) if ( projects[i].exists() && !containsProject( list, projects[i] ) )
{ {
list.add( new CProjectSourceLocation( projects[i] ) ); list.add( new CProjectSourceLocation( projects[i] ) );
addReferencedSourceLocations( list, projects[i] ); addReferencedSourceLocations( list, projects[i] );
@ -228,6 +229,18 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
} }
} }
private static boolean containsProject( List list, IProject project )
{
Iterator it = list.iterator();
while( it.hasNext() )
{
CProjectSourceLocation location = (CProjectSourceLocation)it.next();
if ( project.equals( location.getProject() ) )
return true;
}
return false;
}
private Object findFileByAbsolutePath( String fileName ) private Object findFileByAbsolutePath( String fileName )
{ {
Path path = new Path( fileName ); Path path = new Path( fileName );