1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 536413 - ConcurrentModificationException when indexing

- apply patch submitted by duh-sa-sekirom@hotmail.com
- in GCCToolChain join the threads that do include path and macro
  searches before waiting for process so as to prevent a
  ConcurrentModificationException

Change-Id: Iefe6f013007b7bbf00117b5295b5e27489a72834
This commit is contained in:
Jeff Johnston 2018-07-17 14:45:21 -04:00
parent 3ed176d0c2
commit e0c656d2e0

View file

@ -467,7 +467,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
Pattern definePattern = Pattern.compile("#define ([^\\s]*)\\s(.*)"); //$NON-NLS-1$
// First the include path off the error stream
new Thread("Include Path Reader") {
Thread includePathReaderThread = new Thread("Include Path Reader") {
@Override
public void run() {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()))) {
@ -493,9 +493,10 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
CCorePlugin.log(e);
}
}
}.start();
};
includePathReaderThread.start();
new Thread("Macro reader") {
Thread macroReaderThread = new Thread("Macro reader") {
public void run() {
// Now the defines off the output stream
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
@ -511,9 +512,12 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
CCorePlugin.log(e);
}
}
}.start();
};
macroReaderThread.start();
try {
includePathReaderThread.join();
macroReaderThread.join();
process.waitFor();
} catch (InterruptedException e) {
Activator.log(e);