From 862b7399dd9339e6f2db0ca2a80b77bf4abedcc2 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 11 Dec 2023 06:34:53 +0100 Subject: [PATCH] fix wrong localuse frees --- src/dcd/server/autocomplete/localuse.d | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dcd/server/autocomplete/localuse.d b/src/dcd/server/autocomplete/localuse.d index 46b5dd77..86f042bd 100644 --- a/src/dcd/server/autocomplete/localuse.d +++ b/src/dcd/server/autocomplete/localuse.d @@ -60,6 +60,7 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request, auto sortedTokens = assumeSorted(tokenArray); ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, &rba, request.cursorPosition, moduleCache); + scope(exit) pair.destroy(); SymbolStuff getSymbolsAtCursor(size_t cursorPosition) { @@ -71,7 +72,6 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request, // gets the symbol matching to cursor pos SymbolStuff stuff = getSymbolsAtCursor(cast(size_t)request.cursorPosition); - scope(exit) stuff.destroy(); // starts searching only if no ambiguity with the symbol if (stuff.symbols.length == 1) @@ -101,7 +101,6 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request, { size_t pos = cast(size_t) t.index + 1; // place cursor inside the token SymbolStuff candidate = getSymbolsAtCursor(pos); - scope(exit) candidate.destroy(); if (candidate.symbols.length == 1 && candidate.symbols[0].location == sourceSymbol.location && candidate.symbols[0].symbolFile == sourceSymbol.symbolFile)