From 772ac2fa74a0a30cdd1c47c8b93a4503a52c8b72 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Wed, 4 Feb 2015 21:28:25 -0800 Subject: [PATCH] Bug 459186 - Index read locks are leaking --- .../ui/actions/SurroundWithTemplateMenuAction.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SurroundWithTemplateMenuAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SurroundWithTemplateMenuAction.java index 770375a7477..6dc4c3683c3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SurroundWithTemplateMenuAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SurroundWithTemplateMenuAction.java @@ -296,11 +296,15 @@ public class SurroundWithTemplateMenuAction implements IWorkbenchWindowPulldownD TemplateCompletionProposalComputer templateComputer = new TemplateCompletionProposalComputer(); CContentAssistInvocationContext context = new CContentAssistInvocationContext( editor.getViewer(), textSelection.getOffset(), editor, true, false ); - List proposals= templateComputer.computeCompletionProposals(context, null); - if (proposals == null || proposals.isEmpty()) - return null; - - return getActionsFromProposals(proposals, context.getInvocationOffset(), editor.getViewer()); + try { + List 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) {