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

Bug 319668 - NPE in indexer CCorePlugin.getCProjectDescription

This change ensures code in SelectionListenerWithASTManager does not
attempt to compute an AST if the workbench is shutting down. This can
result in a NPE in the CDT core plug-in.

Change-Id: I3a0f921b3327bab9eab7169591f217c4f4766a70
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
This commit is contained in:
Simeon Andreev 2019-09-30 10:29:09 +02:00 committed by Marc-André Laperle
parent 0cd0aa1270
commit c410447f12

View file

@ -35,6 +35,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.ITextEditor;
/**
@ -134,7 +135,7 @@ public class SelectionListenerWithASTManager {
// Try to acquire the lock
while (!monitor.isCanceled() && !fJobLock.acquire(10)) {
}
if (!monitor.isCanceled() && isSelectionValid(selection)) {
if (!monitor.isCanceled() && isSelectionValid(selection) && PlatformUI.isWorkbenchRunning()) {
return calculateASTandInform(workingCopy, selection, monitor);
}
} catch (InterruptedException e) {