mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 511871 - CContentAssistProcessor.createContext may leak index lock
Change-Id: I828c94484c7b1594ba72551b80cd5ed6e6a8576c
This commit is contained in:
parent
d06db08a30
commit
c6955df2e2
1 changed files with 25 additions and 19 deletions
|
@ -266,29 +266,35 @@ public class CContentAssistProcessor extends ContentAssistProcessor {
|
||||||
char activationChar = getActivationChar(viewer, offset);
|
char activationChar = getActivationChar(viewer, offset);
|
||||||
CContentAssistInvocationContext context =
|
CContentAssistInvocationContext context =
|
||||||
new CContentAssistInvocationContext(viewer, offset, fEditor, isCompletion, isAutoActivated());
|
new CContentAssistInvocationContext(viewer, offset, fEditor, isCompletion, isAutoActivated());
|
||||||
if (isCompletion && activationChar == '.' && fReplacementAutoActivationCharacters != null &&
|
try {
|
||||||
fReplacementAutoActivationCharacters.contains('.')) {
|
if (isCompletion && activationChar == '.' && fReplacementAutoActivationCharacters != null &&
|
||||||
IASTCompletionNode node = context.getCompletionNode();
|
fReplacementAutoActivationCharacters.contains('.')) {
|
||||||
if (node != null) {
|
IASTCompletionNode node = context.getCompletionNode();
|
||||||
IASTName[] names = node.getNames();
|
if (node != null) {
|
||||||
if (names.length > 0 && names[0].getParent() instanceof IASTFieldReference) {
|
IASTName[] names = node.getNames();
|
||||||
IASTFieldReference ref = (IASTFieldReference) names[0].getParent();
|
if (names.length > 0 && names[0].getParent() instanceof IASTFieldReference) {
|
||||||
IASTExpression ownerExpr = ref.getFieldOwner();
|
IASTFieldReference ref = (IASTFieldReference) names[0].getParent();
|
||||||
IType ownerExprType = SemanticUtil.getNestedType(ownerExpr.getExpressionType(), SemanticUtil.TDEF);
|
IASTExpression ownerExpr = ref.getFieldOwner();
|
||||||
if (ownerExprType instanceof ICPPUnknownType) {
|
IType ownerExprType = SemanticUtil.getNestedType(ownerExpr.getExpressionType(), SemanticUtil.TDEF);
|
||||||
ownerExprType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) ownerExprType,
|
if (ownerExprType instanceof ICPPUnknownType) {
|
||||||
names[0]);
|
ownerExprType = HeuristicResolver.resolveUnknownType((ICPPUnknownType) ownerExprType,
|
||||||
}
|
names[0]);
|
||||||
if (ownerExprType instanceof IPointerType) {
|
}
|
||||||
context = replaceDotWithArrow(viewer, offset, isCompletion, context, activationChar);
|
if (ownerExprType instanceof IPointerType) {
|
||||||
|
context = replaceDotWithArrow(viewer, offset, isCompletion, context, activationChar);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (context != null && isAutoActivated() && !fCContentAutoActivationCharacters.contains(activationChar)) {
|
||||||
|
// Auto-replace, but not auto-content-assist - bug 344387.
|
||||||
|
context.dispose();
|
||||||
|
context = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (context != null && isAutoActivated() && !fCContentAutoActivationCharacters.contains(activationChar)) {
|
} catch (RuntimeException | Error e) {
|
||||||
// Auto-replace, but not auto-content-assist - bug 344387.
|
if (context != null)
|
||||||
context.dispose();
|
context.dispose();
|
||||||
context = null;
|
throw e;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
|
|
Loading…
Add table
Reference in a new issue