Add workaround for debug command text memory bug due to managed handles gc

This commit is contained in:
Wojtek Figat
2024-10-20 23:25:38 +02:00
parent a2693fa354
commit 449e988a59

View File

@@ -242,6 +242,10 @@ DebugCommandsService DebugCommandsServiceInstance;
void DebugCommands::Execute(StringView command)
{
// TODO: fix missing string handle on 1st command execution (command gets invalid after InitCommands due to dotnet GC or dotnet interop handles flush)
String commandCopy = command;
command = commandCopy;
// Preprocess command text
while (command.HasChars() && StringUtils::IsWhitespace(command[0]))
command = StringView(command.Get() + 1, command.Length() - 1);
@@ -281,6 +285,9 @@ void DebugCommands::Search(StringView searchText, Array<StringView>& matches, bo
{
if (searchText.IsEmpty())
return;
// TODO: fix missing string handle on 1st command execution (command gets invalid after InitCommands due to dotnet GC or dotnet interop handles flush)
String searchTextCopy = searchText;
searchText = searchTextCopy;
ScopeLock lock(Locker);
if (!Inited)