1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

Bug 459186 - Index read locks are leaking

This commit is contained in:
Sergey Prigogin 2015-02-04 20:45:30 -08:00
parent e98bf3e3e3
commit dc08061cc6
2 changed files with 18 additions and 8 deletions

View file

@ -272,11 +272,15 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD
TemplateCompletionProposalComputer templateComputer = new TemplateCompletionProposalComputer();
CContentAssistInvocationContext context = new CContentAssistInvocationContext( editor.getViewer(), textSelection.getOffset(), editor, true, false );
List<ICompletionProposal> proposals= templateComputer.computeCompletionProposals(context, null);
if (proposals == null || proposals.isEmpty())
return null;
return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer());
try {
List<ICompletionProposal> proposals= templateComputer.computeCompletionProposals(context, null);
if (proposals == null || proposals.isEmpty())
return null;
return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer());
} finally {
context.dispose();
}
}
private static ITextSelection getTextSelection(CEditor editor) {

View file

@ -358,13 +358,19 @@ public class ParameterGuessingProposal extends FunctionCompletionProposal {
}
/**
* Returns a list of functions and variables that are defined in current context.
* Returns a list of functions and variables that are defined in the current context.
* @return a list of assignable elements.
*/
private List<IBinding> getAssignableElements() {
int i = getStatementStartOffset(fContext.getDocument(), getStatementStartOffset());
CContentAssistInvocationContext c = new CContentAssistInvocationContext(fTextViewer, i, getCEditor(), true, false);
IASTCompletionNode node = c.getCompletionNode();
CContentAssistInvocationContext context =
new CContentAssistInvocationContext(fTextViewer, i, getCEditor(), true, false);
IASTCompletionNode node;
try {
node = context.getCompletionNode();
} finally {
context.dispose();
}
IASTName[] names = node.getNames();
List<IBinding> allBindings = new ArrayList<>();
for (IASTName name : names) {