1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 08:45:44 +02:00

Fix concurrent update of folding info

This commit is contained in:
Anton Leherbauer 2007-02-14 12:03:21 +00:00
parent d8152e95ec
commit 3daf0d10d8

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2000, 2006 QNX Software Systems and others. * Copyright (c) 2000, 2007 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -90,7 +90,8 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
* Reconcile annotation positions from preprocessor branches. * Reconcile annotation positions from preprocessor branches.
*/ */
private class PreprocessorBranchesReconciler implements ICReconcilingListener { private class PreprocessorBranchesReconciler implements ICReconcilingListener {
volatile boolean fReconciling;
/* /*
* @see org.eclipse.cdt.internal.ui.text.ICReconcilingListener#aboutToBeReconciled() * @see org.eclipse.cdt.internal.ui.text.ICReconcilingListener#aboutToBeReconciled()
*/ */
@ -102,16 +103,21 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
* @see org.eclipse.cdt.internal.ui.text.ICReconcilingListener#reconciled(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit, org.eclipse.cdt.core.IPositionConverter, org.eclipse.core.runtime.IProgressMonitor) * @see org.eclipse.cdt.internal.ui.text.ICReconcilingListener#reconciled(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit, org.eclipse.cdt.core.IPositionConverter, org.eclipse.core.runtime.IProgressMonitor)
*/ */
public void reconciled(IASTTranslationUnit ast, IPositionConverter positionTracker, IProgressMonitor progressMonitor) { public void reconciled(IASTTranslationUnit ast, IPositionConverter positionTracker, IProgressMonitor progressMonitor) {
if (fInput == null) { if (fInput == null || ast == null || fReconciling) {
return; return;
} }
FoldingStructureComputationContext ctx= createContext(fInitialASTReconcile); fReconciling= true;
fInitialASTReconcile= false; try {
if (fPreprocessorBranchFoldingEnabled) { FoldingStructureComputationContext ctx= createContext(fInitialASTReconcile);
ctx.fAST= ast; fInitialASTReconcile= false;
ctx.fASTPositionConverter= positionTracker; if (fPreprocessorBranchFoldingEnabled) {
ctx.fAST= ast;
ctx.fASTPositionConverter= positionTracker;
}
update(ctx);
} finally {
fReconciling= false;
} }
update(ctx);
} }
} }