1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-21 16:05:25 +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(); TemplateCompletionProposalComputer templateComputer = new TemplateCompletionProposalComputer();
CContentAssistInvocationContext context = new CContentAssistInvocationContext( editor.getViewer(), textSelection.getOffset(), editor, true, false ); CContentAssistInvocationContext context = new CContentAssistInvocationContext( editor.getViewer(), textSelection.getOffset(), editor, true, false );
List<ICompletionProposal> proposals= templateComputer.computeCompletionProposals(context, null); try {
if (proposals == null || proposals.isEmpty()) List<ICompletionProposal> proposals= templateComputer.computeCompletionProposals(context, null);
return null; if (proposals == null || proposals.isEmpty())
return null;
return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer()); return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer());
} finally {
context.dispose();
}
} }
private static ITextSelection getTextSelection(CEditor editor) { 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. * @return a list of assignable elements.
*/ */
private List<IBinding> getAssignableElements() { private List<IBinding> getAssignableElements() {
int i = getStatementStartOffset(fContext.getDocument(), getStatementStartOffset()); int i = getStatementStartOffset(fContext.getDocument(), getStatementStartOffset());
CContentAssistInvocationContext c = new CContentAssistInvocationContext(fTextViewer, i, getCEditor(), true, false); CContentAssistInvocationContext context =
IASTCompletionNode node = c.getCompletionNode(); new CContentAssistInvocationContext(fTextViewer, i, getCEditor(), true, false);
IASTCompletionNode node;
try {
node = context.getCompletionNode();
} finally {
context.dispose();
}
IASTName[] names = node.getNames(); IASTName[] names = node.getNames();
List<IBinding> allBindings = new ArrayList<>(); List<IBinding> allBindings = new ArrayList<>();
for (IASTName name : names) { for (IASTName name : names) {