mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 192664: NPE in CReconciler
This commit is contained in:
parent
0a9f69a04c
commit
33bf35f24f
2 changed files with 18 additions and 4 deletions
|
@ -208,7 +208,12 @@ public class ASTCache {
|
||||||
try {
|
try {
|
||||||
IASTTranslationUnit ast= getAST(tUnit, index, wait, monitor);
|
IASTTranslationUnit ast= getAST(tUnit, index, wait, monitor);
|
||||||
ILanguage lang= (tUnit instanceof TranslationUnit) ? ((TranslationUnit) tUnit).getLanguageOfContext() : tUnit.getLanguage();
|
ILanguage lang= (tUnit instanceof TranslationUnit) ? ((TranslationUnit) tUnit).getLanguageOfContext() : tUnit.getLanguage();
|
||||||
return astRunnable.runOnAST(lang, ast);
|
if (ast == null) {
|
||||||
|
return astRunnable.runOnAST(lang, ast);
|
||||||
|
}
|
||||||
|
synchronized (ast) {
|
||||||
|
return astRunnable.runOnAST(lang, ast);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
|
|
|
@ -126,9 +126,9 @@ public class CReconcilingStrategy implements IReconcilingStrategy, IReconcilingS
|
||||||
forced= workingCopy.isConsistent();
|
forced= workingCopy.isConsistent();
|
||||||
ast= workingCopy.reconcile(computeAST, true, fProgressMonitor);
|
ast= workingCopy.reconcile(computeAST, true, fProgressMonitor);
|
||||||
}
|
}
|
||||||
} catch(OperationCanceledException oce) {
|
} catch (OperationCanceledException oce) {
|
||||||
// document was modified while parsing
|
// document was modified while parsing
|
||||||
} catch(CModelException e) {
|
} catch (CModelException e) {
|
||||||
IStatus status= new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, IStatus.OK, "Error in CDT UI during reconcile", e); //$NON-NLS-1$
|
IStatus status= new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, IStatus.OK, "Error in CDT UI during reconcile", e); //$NON-NLS-1$
|
||||||
CUIPlugin.getDefault().log(status);
|
CUIPlugin.getDefault().log(status);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -138,7 +138,16 @@ public class CReconcilingStrategy implements IReconcilingStrategy, IReconcilingS
|
||||||
index= ast.getIndex();
|
index= ast.getIndex();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
((ICReconcilingListener)fEditor).reconciled(ast, forced, fProgressMonitor);
|
if (ast == null) {
|
||||||
|
((ICReconcilingListener)fEditor).reconciled(ast, forced, fProgressMonitor);
|
||||||
|
} else {
|
||||||
|
synchronized (ast) {
|
||||||
|
((ICReconcilingListener)fEditor).reconciled(ast, forced, fProgressMonitor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
IStatus status= new Status(IStatus.ERROR, CUIPlugin.PLUGIN_ID, IStatus.OK, "Error in CDT UI during reconcile", e); //$NON-NLS-1$
|
||||||
|
CUIPlugin.getDefault().log(status);
|
||||||
} finally {
|
} finally {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.releaseReadLock();
|
index.releaseReadLock();
|
||||||
|
|
Loading…
Add table
Reference in a new issue